To all the Apache experts out there...
I'm trying to configure my httpd.conf file so that I flip an environment variable or comment out a single line at the top of an httpd.conf (it's a proxy server) and "enable" redirects in various Location directives.
In the following example I have two proxy locations (app1 and app2). App1 is under maintenance and I'd like to quickly flip this one line item to force it to redirect to a maintenance page. This does not work...
Code:
<VirtualHost *:port>
RewriteEngine On
SetEnvIf Request_URI "app1" app1maint=yes
#SetEnvIf Request_URI "app2" app1maint=yes
<Location /app1>
RewriteCond %{ENV:app1maint} ^yes$
RewriteRule (.*) http://host:port/app1MaintenancePage.html
</Location>
<Location /app2>
RewriteCond %{ENV:app2maint} ^yes$
RewriteRule (.*) http://host:port/app2MaintenancePage.html
</Location>
</VirtualHost>
This whole thing
does work if I put all the Rewrite and Environment directives into the Location directives for each app/location, but that defeats the purpose of this because now an admin has to muck around the httpd.conf file and comment out each line. We have many locations servicing a number of applications so the file can be quite large.