下面是我在home.php页面上用来禁用SSL的htaccess代码,但它没有用。
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^home.php(.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
答案 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]