【发布时间】:2017-04-02 08:52:01
【问题描述】:
我正在尝试强制非 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 重定向到 https://example.com/index.php 我只想将 example.com 重定向到 https://example.com
请帮忙。
【问题讨论】:
-
你可以试试这个:
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{SERVER_NAME}/%$1 [R,L]
标签: .htaccess mod-rewrite