httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikolai Lusan <>
Subject Re: [users@httpd] mod_rewrite and environment variables
Date Mon, 23 Apr 2007 05:49:40 GMT

For anyone interested I have solved this one.

Instead of using SetEnv I am doing a catch all match after enabling the
rewrite engine in each vhost:

RewriteEngine  On
RewriteRule     ^(.*)$  $1      []

Then in the conf file for the rewrites i do the matches as:

RewriteCond   %{REQUEST_FILENAME}  ^/bar$
RewriteCond   %{ENV:SISTER_SITE} (.*)
RewriteRule   ^.*$  http://%1/bar [R=permanent,L]

On Mon, 2007-04-23 at 11:13 +1000, Nikolai Lusan wrote:

> Example:
> Site          "Sister" Site
> in VirtaulHost for
> Include  common_rewrites.conf
> in VirtaulHost for
> Include  common_rewrites.conf
> Then in common_rewrites.conf
> RewriteCond   %{REQUEST_FILENAME}  ^/bar$
> RewriteRule ^.*$  http://%{ENV:SISTER_SITE}/bar [R=permanent,L]
> This approach does not seem to work, although the environment variables
> can be used in the RewriteCond statement they seem to be ignored in the
> RewriteRule statement.


Nikolai Lusan
Systems Administrator

Hitwise Pty. Ltd.
Level 7 / 580 St Kilda Road
Melbourne, Victoria 3004
Phone: +61 3 8530 2400
Fax:  +61 3 9529 8907

Worldwide:  •  United States  •  United Kingdom  •  Australia  •  New
Zealand  •  Singapore  •  Hong Kong 

To subscribe to our complimentary monthly newsletter, visit:

The information transmitted may be confidential, is intended only for
the person to which it is addressed, and may not be reviewed,
retransmitted, disseminated or relied upon by any other persons. If you
received this message in error, please contact the sender and destroy
any paper or electronic copies of this message. Any views expressed in
this email communication are those of the individual sender, except
where the sender specifically states otherwise. Hitwise does not
represent, warrant or guarantee that the communication is free of
errors, virus or interference.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message