apache 已经配置好https 加密证书,可以实现https://www.dwoke.com 加密访问
我想把http://www.dowoke.com 和http://dwoke.com 做301重定向到https://www.dwoke.com.com 这个域名上。
在drupl8 根目录下的配置文件.htaccess 文件内修改这两个代码
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/foo will be redirected to http://www.example.com/foo)
# uncomment the following:
#RewriteCond %{HTTP_HOST} .
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/foo will be redirected to http://example.com/foo)
# uncomment the following:
#RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
我发现只能选择一个,不能同时打开,如果同时打开会出现网站无法打开。
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
选择这一个,只能实现http://dwoke.com 跳转到http://www.dwoke.com
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
选择这一个,只能实现http://www.dwoke.com 跳转到http://dwoke.com
如果这样设置不是我想要的,如果知道的朋友请告知一下,谢谢