【发布时间】:2017-10-12 19:23:44
【问题描述】:
我想强制将任何对我网站的访问重定向到 https。
我的 htaccess 规则如下:
# rewrite address
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mytestsite\.eu$ [NC]
RewriteRule ^(.*)$ https://www.mytestsite.eu/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ https://www.mytestsite.eu/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^(.+)\.mytestsite\.eu$ [NC]
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^ https://www.mytestsite.eu/ [L,R]
我怎样才能做到这一点?
【问题讨论】:
标签: .htaccess https url-redirection http-redirect