Apache mod_rewrite REDIRECT_STATUS condition causing directory listing

后端 未结 1 659
误落风尘
误落风尘 2020-12-03 15:26

I have the following htaccess rewrite rules. The one rule condition to prevent looping was originally written this way:

RewriteCond %{ENV:REDIRECT_STATUS} ^.         


        
相关标签:
1条回答
  • 2020-12-03 15:54

    You have this condition to stop looping:

    ## Internal Redirect Loop Protection
    RewriteCond %{ENV:REDIRECT_STATUS} 200
    RewriteRule ^ - [L]
    

    This works by checking internal Apache variable %{ENV:REDIRECT_STATUS}. This variable is empty at the start of rewrite module but is set to 200 when first successful internal rewrite happens. This above condition says bail out of further rewrites after first successful rewrite and stops looping.

    0 讨论(0)
提交回复
热议问题