Forum Moderators: phranque
I have:
http://www.example.com
and
http://www.example.com/test/
When the user goes to www.example.com, he should see the content of www.example.com/test/, same for www.example.com/test.html, going to www.example.com/test/test.html, and so on (everything should be redirected, images, html files, php files, etc)
So basicly I wan't to redirect the root folder to a folder inside it.
Here's what I tried:
RewriteEngine on
RewriteRule ^(.+)$ test/$1
but it's crashing everything, and it's quite obvious why, but how to fix it?
Thanks in advance
You are not going to be able to come up with a "universal" solution to this, so I suggest naming your new top-level directory something unique, such as "~test" -- with the "~" being the usual character used for various purposes similar to this.
Then you'd have:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/~test/
RewriteRule ^(.*)$ /~test/$1 [L]
Jim
I was pretty close already but always tried to use %{REQUEST_FILENAME} instead of %{REQUEST_URI} to avoid the infinite loop.