使用htaccess在home.php上禁用SSL不起作用


Disabling SSL on home.php using htaccess is not working?

下面是我用来在home.php页面上禁用SSL的htaccess代码,但它不起作用

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

它不工作,因为你的代码是向后的。如果您想将关闭 https用于home.php,您需要检查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]