如何使用的.htaccess禁用SSL关闭但不包括两类所有网页? (login.php中,register.php) [英] How to use .htaccess to disable SSL off for all pages except two? (login.php, register.php)
问题描述
可能重复:
<一href="http://stackoverflow.com/questions/7189484/htaccess-problem-turn-off-ssl-for-every-page-except-login-php-and-register-p">.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.
这篇关于如何使用的.htaccess禁用SSL关闭但不包括两类所有网页? (login.php中,register.php)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!