我想将我网站的每个 url 从 http://重定向到 https://
我的问题是我的 .htaccess 中已经有一个路由系统:
RewriteRule ([^.]+)\.html$ index.php?/$1 [QSA,L]
我试着添加这个,但是路由坏了:
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
谁能帮帮我?
谢谢!
最佳答案
在旧的 RewriteRule 之前添加 HTTP 到 HTTPS:
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
RewriteRule ([^.]+)\.html$ index.php?/$1 [QSA,L]
关于.htaccess - 存在生根系统时从 HTTP 到 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33503613/