如何将http重定向到除特定页面之外的https,然后将https重定向到同一页面的http?

时间:2016-05-19 18:16:55

标签: apache http mod-rewrite ssl https

我将所有流量从http重定向到https,但特定页面除外,但我希望在该特定页面上将https重定向到http。我怎样才能做到这一点。以下是我到目前为止的情况。

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

1 个答案:

答案 0 :(得分:0)

我想通了,我把上面的内容留在了httpd.conf文件中,然后在页面目录中我编辑了.htaccess文件并添加了下面的代码。

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
相关问题