Ad

Mod Rewrite Env Variables

- 1 answer

Using this rudimentary example, I can't seem to get Environment Variables to 'take'

SetEnv APPLICATION_ENV production
RewriteEngine On
RewriteCond %{ENV:APPLICATION_ENV} =production 
RewriteRule ^loading$ /images/loading.gif [NC,L]

for some reason going to

/loading 

does not show the loading.gif

I have tried many permutations of the comparison using the syntax ^production but nothing works

I know just removing the RewriteCond will make it work, but this question is about correctly comparing using an Environment Variable

Ad

Answer

You need to set the environment variable with mod_rewrite too:

RewriteRule ^ - [E=APPLICATION_ENV:production]
Ad
source: stackoverflow.com
Ad