Christopher
Christopher

Reputation:

Mod Rewrite Env Variables

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

Upvotes: 1

Views: 2373

Answers (1)

Gumbo
Gumbo

Reputation: 655239

You need to set the environment variable with mod_rewrite too:

RewriteRule ^ - [E=APPLICATION_ENV:production]

Upvotes: 5

Related Questions