【问题标题】:How can I redirect http to https except a specific page, then redirect https to http for that same page?如何将 http 重定向到除特定页面之外的 https,然后将 https 重定向到同一页面的 http?
【发布时间】:2016-09-16 19:16:40
【问题描述】:

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

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

【问题讨论】:

  • RewriteCond %{HTTPS} 上 RewriteCond %{REQUEST_URI} ^/page RewriteRule (.*) http://%{HTTP_HOST}/page
  • 出于某种原因,它做了完全相同的事情。该特定页面的 https 仍然是 https,它永远不会重定向到 http。有什么想法吗?

标签: apache http mod-rewrite ssl https


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-18
    • 1970-01-01
    • 1970-01-01
    • 2017-01-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多