如何使用的.htaccess禁用SSL关闭但不包括两类所有网页? (login.php中,register.php)但不、两类、如何使用、网页

2023-09-02 11:26:11 作者:春去秋來一抹紅。

可能重复:   .htaccess问题 - (关闭SSL的每一页,除了login.php中和register.php)

我对我所有的网站启用SSL,但我只需要两页的的login.php 和 register.php ,我怎么可以禁用它的所有网页上除了这两个?所以,当我重定向说从的login.php主页,我不想ENY警告等。

I have SSL enabled on all my website, but I only need it on two pages login.php and register.php, How can I disable it on all pages except these two? So when I redirect say from login.php to home page, I don't want eny warnings etc.

感谢您

推荐答案

所有现代浏览器会显示一个警告,如果你离开一个安全的连接,所以只要你切换到HTTPS你不应该切换回来,如果你不'吨要警告。

All modern browsers will display a warning if you leave a secure connection, so as soon as you've switched to HTTPS you should not switch back if you don't want a warning.

要切换到HTTPS为这两个页面使用类似

To switch to HTTPS for those two page use something like

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

有关更多示例,请参阅这里。

For more examples see HERE.