Htaccess http to https with php exception



我最近将我的网站更改为https,我使用.htaccess重写通过https发送所有内容...

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

但是,一个页面(联系我们.php(在几个浏览器(IE和Chrome(上抛出https错误,我考虑过修复这些错误,但它们很难。对我来说,最简单的解决方法是使有问题的页面(contact-us.php(成为全局http到https规则的例外。但是怎么做?!

提前感谢您的任何回复。

你可以使用它:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/contact-us.php [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]
RewriteCond %{HTTPS} on
RewriteRule ^contact-us.php http://%{HTTP_HOST}/contact-us.php [NC,L,R=302]

最新更新