.htaccess 将非HTTPS重定向到HTTPS
我试图强制非HTTPS访问者使用HTTPS,请参阅下面的代码.htaccess 将非HTTPS重定向到HTTPS,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我试图强制非HTTPS访问者使用HTTPS,请参阅下面的代码 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] RewriteCond %{HTTPS} off RewriteRule (.*) https://%{SERVER_NAME}/%$1 [R,L] 它将example.com重定向到 我只想example.com重定向到 请帮助。颠倒顺序: RewriteEng
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/%$1 [R,L]
它将example.com重定向到
我只想example.com重定向到
请帮助。颠倒顺序:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
您可以尝试以下操作:
RewriteCond%{SERVER\u PORT}80 RewriteRule^(.*)$https://%{SERVER\u NAME}/%$1[R,L]