开发者

mod_rewrite works for '/test', but not for '/'

开发者 https://www.devze.com 2022-12-21 10:43 出处:网络
The following code inside an .htaccess file is behaving incorrectly.. RewriteEngine on RewriteBase / RewriteCond %开发者_开发技巧{HTTP_HOST} ^(domain\\.com)$ [NC]

The following code inside an .htaccess file is behaving incorrectly..

RewriteEngine on
RewriteBase /

RewriteCond %开发者_开发技巧{HTTP_HOST} ^(domain\.com)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /test/$1 [L,QSA]

The above will correctly send requests to 'domain.com/uri-here' to the '/test/' directory.. However, requests to 'domain.com/' are not matched / routed.

I'm unsure if there's an issue with the environment, though it seems so due to same / similar code working on another server.

What am I doing wrong?

Thanks in advance!


/ is likely matching against RewriteCond %{REQUEST_FILENAME} !-d

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号