【问题标题】:.htaccess to control HTTPS on certain pages.htaccess 在某些页面上控制 HTTPS
【发布时间】:2014-05-05 23:16:00
【问题描述】:

我正在使用 htaccess 将某些页面重定向到 htaccess。我使用的代码是

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} /core/marketing/editprofile
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]

页面正在为/core/marketing/editprofile 重定向,但在此之后它不会为其他页面重定向回 http。

请告诉我,我也可以启用 https 到 http 重定向吗?

【问题讨论】:

    标签: .htaccess http mod-rewrite https rewrite


    【解决方案1】:

    您必须对其他页面执行相反的操作:

    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} /core/marketing/editprofile
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    RewriteCond %{HTTPS} on
    RewriteCond %{REQUEST_URI} !/core/marketing/editprofile
    RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    

    【讨论】:

      猜你喜欢
      • 2010-11-15
      • 1970-01-01
      • 2011-08-08
      • 2011-01-22
      • 1970-01-01
      • 1970-01-01
      • 2012-07-11
      • 2023-03-03
      • 1970-01-01
      相关资源
      最近更新 更多