PDA

View Full Version : mod_rewrite for the whole directory


actiemonitor
08-12-2006, 04:45 PM
Hi,

I'm trying to get a redirect for the whole directory in a webroot to a sub directory working

This is the situation:
http://test.domain.com
Every file (and no file) must redirect from /test to test/subdir/ (/test is a dir in de webroot working as a subdomain)

This is what I have.
RewriteEngine on
RewriteRule ^/(.*)$ /subdir/$1 [QSA,R,L]

Which is not working. It will continue serving my index.php from the test.domain.com instead of test.domain.com/subdir/

AND ;) I want that it will not shown in the URL.

Anybody any idea?
thnx in advance.

sheila
08-16-2006, 01:01 AM
I am not at all a mod_rewrite expert. I'm not really even a mod_rewrite novice. But...

It looks to me like you have a looping situation in what you're trying to do. Namely /test/subdir does match /test

So if you redirect from /test to /test/subdir then even that redirected request will match the rewrite instructions and it will get redirected again.

*IF* it matches in the first place, which I'm not sure is happening, because it seems to me you wouldn't even be getting any successfully returned requests if this were happening...