【问题标题】:force http on one page when other pages forcet to https当其他页面强制为 https 时,在一个页面上强制 http
【发布时间】:2016-07-28 03:02:33
【问题描述】:

我在.htaccess 中使用此重定向代码来强制所有地址使用https:

RewriteEngine On 

RewriteCond %{HTTPS} off
RewriteRule (.*) https://Domain.com%{REQUEST_URI} [L,R=301,NC]

RewriteCond %{HTTP_HOST} ^www.Domain.com [NC]
RewriteRule (.*) https://Domain.com%{REQUEST_URI} [L,R=301,NC]

我想要一个解决方案来强制像 domain.com/example 这样的一个页面只使用 http 而不是强制 https 。 如何修改重定向代码?

非常感谢

【问题讨论】:

    标签: .htaccess redirect https url-rewriting


    【解决方案1】:

    要从 https 重定向中排除页面,您可以使用:

    RewriteEngine On
    
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !^/example
    RewriteRule (.*) https://Domain.com%{REQUEST_URI} [L,R=301,NC]
    

    【讨论】:

      猜你喜欢
      • 2013-01-22
      • 2014-01-22
      • 1970-01-01
      • 1970-01-01
      • 2012-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多