I'm hosting a few small client pages within my web application. Basically, they all are instances of the web application I wrote, for different clients. I'm deploying with capistrano, and so each time I deploy a new release, it actually gets deployed to a subdirectory called 'current' of the client's directory. So, for a client named client-name
, it deploys to /var/www/deployments/client-name/current/
(Actually, this is a symlink to a release, but that's not important). My webapp requires that the "root" of the app points to the /main
subdirectory.
Basically, my problem is this:
My root domain is client.example.com
. What I want to do is be able to redirect a request typed into the browser such that http://client.example.com/client-name/something
is actually pointing to http://client.example.com/client-name/current/main/something
, where client-name
is variable (there are too many for me to simply enumerate, although there is definitely less than 100). Ideally, this would be done without changing the location in the address bar.
I feel like this is a pretty simple use of Apache mod_rewrite
, but I can't seem to find an example that does what I'm looking for. I would appreciate it if someone could help me out, because mod_rewrite
makes my head hurt. ;)