【问题标题】:rewrite url from http to https using htaccess使用 htaccess 将 url 从 http 重写为 https
【发布时间】:2015-02-21 01:34:52
【问题描述】:

我希望带有 https 的链接转发到 http,但是它们必须满足以下条件:

只有 https://example.com/non/ 格式的 url 和斜杠后面的内容被转发到 http 但是没有 /non/ 条件的链接保持不变

我想用 htaccess 来做这个

【问题讨论】:

    标签: apache .htaccess mod-rewrite redirect rewrite


    【解决方案1】:

    您可以在DOCUMENT_ROOT/.htaccess 文件中使用此代码:

    RewriteEngine On
    
    RewriteCond %{HTTPS} on
    RewriteRule ^non(/.*)?$ http://{HTTP_HOST}$1 [L,NC,NE,R=302]
    

    【讨论】:

      猜你喜欢
      • 2021-12-28
      • 2014-07-18
      • 1970-01-01
      • 2017-05-04
      • 2014-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-20
      相关资源
      最近更新 更多