【发布时间】:2016-05-13 17:11:50
【问题描述】:
我们有这个 htaccess 代码可以将非 www 的 URL 重定向到 https://www:
#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]
网站有专用IP,当我们输入IP地址时,重写引擎会将“107.180.56.244”重定向到“https://www.107.180.56.244”,网站将无法加载。 我们该怎么办?
【问题讨论】:
标签: linux apache .htaccess mod-rewrite rewrite