Tips for debugging .htaccess rewrite rules

后端 未结 16 3104
萌比男神i
萌比男神i 2020-11-21 05:17

Many posters have problems debugging their RewriteRule and RewriteCond statements within their .htaccess files. Most of these are using a shar

16条回答
  •  既然无缘
    2020-11-21 05:34

    I'll leave this here, maybe obvious detail, but got me banging my head for hours: be careful using %{REQUEST_URI} because what @Krist van Besien say in his answer is totally right, but not for the REQUEST_URI string, because the out put of this TestString starts with a /. So take care:

    RewriteCond %{REQUEST_URI} ^/assets/$  
                                ^
                                | check this pesky fella right here if missing
    

提交回复
热议问题