views:

40

answers:

1

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!

+2  A: 

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

abrahamvegh