Mod rewrite at top level to sub directory


#1

Hi all, I’m very new to url rewriting. I’ve been able to get very simple rewriting to work (one particular file rewritten as another file), but now I’m trying to do what I actually want my site to do:

rewrite all urls to the same url with an extra directory in it. For example,

http://www.example.com/ => http://www.example.com/prod/
http://www.example.com/a/b/file.html => http://www.example.com/prod/a/b/file.html

Why am I doing this? Because I want to be able to have a simple staging vs production scheme: I can upload a new version of my site in the folder “stage” at the document root. Then I can go to http://www.example.com/stage to test out the new code (btw, I think this means I have to have a special rule that says to leave alone any requests to /stage). Now, when I’m ready to “deploy”, I just rename “stage” to “prod”.

Thanks for any advice!