【问题标题】:The page isn't redirecting properly - HTTPS HTACCESS rewrite error页面未正确重定向 - HTTPS HTACCESS 重写错误
【发布时间】:2014-03-12 07:42:09
【问题描述】:

我有以下 htaccess 重写规则

rule1 导致了无限循环错误。我正在尝试将所有请求重定向到 HTTPS,但它不起作用。

由于 rule1,rule2 也被阻止。当我评论 rule1 时,一切都很好。

如果我更改顺序,也会发生此无限循环错误。

请帮我解决这个错误

RewriteEngine On
RewriteBase /

#Rule 1: Rewrite all the requests to HTTPS
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

//Rule 2: redirect to the account closed setup
RewriteRule ^(?:abcd)/A-Report/(.+)$ /closed/$1 [NC,L]

提前致谢。

【问题讨论】:

    标签: php apache .htaccess apache2 lamp


    【解决方案1】:

    基于此question

    RewriteEngine on
    
    # Check for POST Submission | 
    # Because POST parameters aren't retained on a redirect.
    # You can omit that line if you want to make sure that all POST submissions are secure   
    # (any unsecured POST submissions will be ignored)
    RewriteCond %{REQUEST_METHOD} !^POST$
    
    # Forcing HTTPS
    RewriteCond %{HTTPS} !=on [OR]
    RewriteCond %{SERVER_PORT} 80
    # Pages to Apply
    RewriteCond %{REQUEST_URI} ^something_secure [OR]
    RewriteCond %{REQUEST_URI} ^something_else_secure
    RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-08
      • 2013-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-05
      相关资源
      最近更新 更多