【问题标题】:How to Redirect Https to Http for certain url如何将 Https 重定向到特定 url 的 Http
【发布时间】:2018-12-04 11:21:22
【问题描述】:

我正在将我的网站从htaccess重定向到https://
我现在需要为下面的特定网址做些什么,它将重定向到http://

mydomain.com/index.php?view=news

我尝试过以下方法,但它不起作用
所有页面都重定向到 https://

RewriteCond %{HTTPS} off
RewriteCond %{THE_REQUEST} !/index.php?view=news [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

我如何将特定的 url 重定向到 http 和其他到 https

【问题讨论】:

  • 你试过硬刷新和清除缓存吗?
  • 是的,我每次都在尝试清除缓存但不起作用

标签: .htaccess https


【解决方案1】:

您需要在THE_REQUEST 正则表达式模式中转义问号?,因为它是一个正则表达式特殊字符

RewriteCond %{HTTPS} off
RewriteCond %{THE_REQUEST} !/index.php\?view=news [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-07
    • 2015-11-02
    • 1970-01-01
    • 2018-06-25
    • 2013-10-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多