I must setup a staging and production atmosphere on a single shared server. So, brilliantly, I must have the ability to produce a structure such as the following around the server:
/stage/ /lib/ /web/ /js/ /css/ index.php ... /production/ /lib/ /web/ /js/ /css/ index.php ...
However, although I can alter the document cause of an additional subdomain or addon domain, I'm not able to alter the document cause of the main domain. So, I'm tied to the document root being /public_html/.
I'd like the staging atmosphere to become accessible through stage.domain.com (pointing to /stage/web/), and each other subdomain, *.domain.com or domain.com, path to the development atmosphere (pointing to /production/web/).
Knowing that, In my opinion I want a strong mod_rewrite script for the job (.htaccess level). Since, I'm a novice at mod_rewrite, does someone understand how to write a script which will transparently route the demands properly?
It is possible to better method to handle both of these conditions on the shared server?
If you cannot alter the document cause of primary domain. Are you able to produce a symlink in
production folder to
/web/production. Enable symlinks.
RewriteCond !-f RewrireRule ^(.*)$ production/$1 [QSA,L]