I am trying to define an environment variable in my .htaccess file, and then run a rewrite condition using that variable. Below is what I have in my .htaccess file, but the rew
mod_rewrite doesn't use variables set via SetEnv, instead use this method:
#set to 'live' or 'maintenance'
RewriteRule .* - [E=STATUS:maintenance]
#If the ENVIRONMENT variable is 'maintenance' then show a maintenance page
RewriteCond %{REQUEST_URI} !maintenance.html [NC]
RewriteCond %{ENV:STATUS} ^maintenance$
RewriteRule ^.*$ /maintenance.html [L]
The first line of the bottom three, makes sure that once the user is redirected to the file "maintenance.html", it will not be redirected again. Else the user keeps getting redirected to the same file, causing an 500 internal server error saying "AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error."