这个解决方案http://domain to https://www in one redirect
似乎不适合我。我想要.(和OP一样)
http://example.com
http://www.example.com
https://example.com全部重定向到https://www.example.com
我尝试过许多解决方案,但似乎没有任何效果。
详细信息:
-I为站点的www.example.com版本安装了ssl。-Running wordpress -tried ssl插件和nothing运行-tried以下htaccess规则,第一个似乎什么也不做,第二个导致无限循环
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]第二次尝试..。
RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{HTTP_HOST} ^(www\.)?your domain name\.com$ [NC]
RewriteRule ^$ https://www.your domain name.com/%{REQUEST_URI} [R,L]这个引起了一个循环..。
我开始认为我的方法是错误的。其中一个不应该起作用吗?如果没有,我如何在www子域上完全保护这个站点?
发布于 2015-03-02 20:46:57
这就是你需要做的才能把一切都整合在一起。
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC,OR]
RewriteCond %{HTTPS} !^on
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R=301,L]显然,用您的真实域名替换yoursite.com。让我知道这对你来说是怎么回事。
https://stackoverflow.com/questions/28818976
复制相似问题