Apache RewriteEngine从HTTPS回退到HTTP失败

时间:2015-03-05 21:40:15

标签: apache .htaccess mod-rewrite

Linux Debian 7.8服务器运行Apache和PHP5.4.36-0 + deb7u3。网站根目录是默认的/ var / www /

该网站有一个登录页面,然后是其他文件夹,php页面等。主要是我只想要登录页面,(identification.php),页面被强制为HTTPS。所以我设置并配置了RewriteEngine。

我在文档根目录中有一个.htaccess文件,其内容如下所示。我的问题是,如果用户点击http://www.example.com/identification.php它已正确转换为HTTPS。但是,如果登录后他们然后导航到另一个页面,它也作为HTTPS提供,这不是我想要的。我以为我的.htaccess配置强制其他页面回到HTTP。

谁能告诉我哪里出错了?所有东西都必须通过HTTP传递.php页面。

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI}  ^/identification\.php$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]

RewriteCond %{REQUEST_URI}  !^/identification\.php$
RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=302,L] 

0 个答案:

没有答案
相关问题