我目前正在尝试将所有流量重定向到 https://www .example.com
我在.htaccess中设置了以下代码:
#First rewrite any request to the wrong domain to use the correct one (here
www.)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#Now, rewrite to HTTPS:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
除了这种情况外,一切正常:
如果我转到https://example.com/examplepage,我不会重定向到https:// www .example.com / examplepage
如果我转到 http ://example.com/examplepage,我会被重定向到 https://**example.com/examplepage,而不是https:// * * WWW .example.com的/ examplepage
有什么想法吗?
非常感谢