This is a discussion on SetEnv + RewriteCond within the Apache Web Server forums, part of the Web Server and Related Forums category; I'm triyng to use envirment variables in RewriteCond's, something like this <VirtualHost> RewriteEngine on SetEnv switch ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm triyng to use envirment variables in RewriteCond's, something like this
<VirtualHost> RewriteEngine on SetEnv switch true RewriteCond %{ENV:switch} ^true$ RewriteRule ^.*xxx.*$ /toxxx/ [R,L] ... </VirtualHost> But this is not working. What can be wrong? Thanx -- Best regards, Maxim Cherniavsky mailto:maxim@mtu.ru |
|
|||
|
> I'm triyng to use envirment variables in RewriteCond's, something like this
> > <VirtualHost> > RewriteEngine on > SetEnv switch true > > RewriteCond %{ENV:switch} ^true$ > RewriteRule ^.*xxx.*$ /toxxx/ [R,L] > ... > </VirtualHost> > > But this is not working. What can be wrong? > Thanx if you set those env-variables yourself with mod_env, the result depends on the execution order of the modules, which for apache 1.3 is the reverse loading/adding order (added/loaded last modules get their go first) and afaik with apache2 is mostly fixed in the module source (not shure here wether it's always fixed and how it can be changed). so with 1.3 you might experiment with moving mod_env to the bottom of the LoadModule and/or AddModule lists and retry, or you set the environment variable with mod_rewrite (see [E=variable:value] flag to RewriteRule), which should work in any case. joachim |