Forum Moderators: phranque
# These works for main page and rules.php
#RewriteRule ^$ /mysite.net/ [L]
#RewriteRule ^rules.php$ /mysite.net/rules.php [L]#Why doesn't this work?
RewriteCond %{HTTP_HOST} ^www\.mysite\.net
RewriteRule ^(.*)$ /test/$1
Welcome to WebmasterWorld!
#Why doesn't this work?
RewriteCond %{HTTP_HOST} ^www\.mysite\.net
RewriteRule ^(.*)$ /test/$1
If this is the case, your server error log file will probably show several requests with /test/ prefixes piling up in front of them as the rule is applied multiple times, ending with a server error.
The fix is to explicitly require that the URL has not been previously rewritten before rewriting can proceed:
RewriteCond %{REQUEST_URI} !^/test/
RewriteRule (.*) /test/$1 [L]