使用htaccess在home.php上禁用SSL无效?

时间:2015-09-22 20:48:36

标签: php regex .htaccess ssl

下面是我在home.php页面上用来禁用SSL的htaccess代码,但它没有用。

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^home.php(.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

1 个答案:

答案 0 :(得分:3)

由于您的代码是倒退的,它无法正常工作。如果您想为home.php启用关闭 https,则需要检查https 是否已关闭。

RewriteEngine On
RewriteCond %{HTTPS} ^on
RewriteRule ^home\.php$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

根据您的评论,您需要排除home.php。

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/home\.php$ [NC] 
RewriteRule ^(.*)$ https://www.my-site.com/$1 [R=301,L]
相关问题