SetEnv + RewriteCond

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 ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-09-2003
Maxim Cherniavsky
 
Posts: n/a
Default SetEnv + RewriteCond

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
  #2 (permalink)  
Old 12-14-2003
Joachim Ring
 
Posts: n/a
Default Re: SetEnv + RewriteCond

> 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:45 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0