I\'m working on a app that uses url rewrites and has a specific .htaccess configuration. When working on the app I have three eviorments:
One option would be to setup environment variables in httpd.conf
(or elsewhere) that define your environment.
For example (in httpd.conf
):
SetEnv ENVIRONMENT production
(in .htaccess
)
RewriteEngine on
# Development
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} != /favicon.ico
RewriteCond %{ENV:ENVIRONMENT} = development
RewriteRule ^(.*)$ /app/index.php?request=$1 [L,QSA]
# Staging
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} != /favicon.ico
RewriteCond %{ENV:ENVIRONMENT} = staging
RewriteRule ^(.*)$ /html/app/index.php?request=$1 [L,QSA]
# Production
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} != /favicon.ico
RewriteCond %{ENV:ENVIRONMENT} = production
RewriteRule ^(.*)$ /index.php?request=$1 [L,QSA]
Untested, but I think the concept is sound enough to figure out any issues ;-)