我在htaccess中使用此代码从http重定向到https。如果index.php文件
,我不需要重定向RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
我怎么能这样做。
答案 0 :(得分:1)
你可以在RewriteRule
中调整你的模式:
RewriteCond %{HTTPS} off
RewriteRule !^(index\.php)?$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L,NC]
除了着陆页和^(index\.php)?$
之外, index.php
将匹配任何内容。