Apache 2 mod_rewrite: SetEnv and RewriteCond

Discussion in 'Apache' started by purba, Jul 20, 2006.

  1. #1
    Hi!

    I'm trying to set Environment variable as a condition to Rewrite.

    If we use Rewrite's "native" variable like %{REMOTE_HOST}, everything works perfect, but when we try to use ENV variable:

    SetEnv VAR1 v1value
    RewriteCond %{ENV:VAR1} ^1$
    RewriteRule ^(.*)$  http://192.168.0.183/$1  
    Code (markup):
    In rewrite log appears the following mesage:

    RewriteCond: input='' pattern='^1$' => not-matched
    Code (markup):
    this means that RewriteCond does not actually "see" this variable.


    If we use SetEnvIf instead of SetEnv, it works OK.

    Any ideas of What the problem can be?
     
    purba, Jul 20, 2006 IP