Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SetEnv + RewriteCond

36 views
Skip to first unread message

Maxim Cherniavsky

unread,
Dec 9, 2003, 12:18:11 PM12/9/03
to
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:ma...@mtu.ru

Joachim Ring

unread,
Dec 13, 2003, 8:48:58 PM12/13/03
to
> 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

0 new messages