在堆栈溢出上有许多类似的解决方案,如htaccess http to https with www. Without redirecting sub domain。
然而,我需要的是:
我正在运行一个WordPress多点网站,没有通配符SSL。
我现正使用以下方法:
非WWW
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} www.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]非WWW和非HTTPS子域
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !=subdomain1.main.com
RewriteCond %{HTTP_HOST} !=subdomain2.main.com
RewriteCond %{HTTP_HOST} !=subdomain3.main.com
RewriteCond %{HTTP_HOST} !=subdomain4.main.comSSL
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}发布于 2016-06-21 08:17:09
这是你想要的吗?
RewriteEngine On
RewriteBase /
# www is redirected to base domain
RewriteCond %{HTTP_HOST} ^www\.([^\.]+\.[^\.]+)$
RewriteRule ^(.*)$ https://%1/$1 [L,R=301]
# base domain should use HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^[^\.]+\.[^\.]+$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]
# other domain should use HTTP
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^[^\.]+\.[^\.]+$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,R=301]https://stackoverflow.com/questions/37935805
复制相似问题