httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: [users@httpd] Reverse RewriteCond?
Date Tue, 30 Jun 2009 20:37:53 GMT
Mike -- EMAIL IGNORED wrote:
> I have (set in /etc/bashrc):
>    echo $HTML_TST
>    aa|bb|cc|dd|ee
> 
> and I tried:
> 
>    RewriteCond  ee %{ENV:HTML_TST}
> 
> following the documentation that says:
> 
>    Syntax: RewriteCond TestString CondPattern
> 

but the documentation never says that CondPattern may contain things 
like %{variable}.  TestString may, but not CondPattern.


> I expected ee to be recognized as one ofthe alternatives
> in the pattern.  It didn't work.

No, because %{ENV:HTML_TST} is interpreted as a pattern like
/%{ENV:HTML_TST}/, which means it is looking for
- a precent sign
- followed by a { sign
- etc...

> 
> Frustrated, I tried:
> 
>    RewriteCond  %{ENV:HTML_TST} ee
> 
> To my surprise, it did work, and as hoped, ff failed to
> match.
> 

What it does is comparing the *string* "aa|bb|cc|dd|ee", with the 
pattern /ee/.
So yes, the string matches the pattern, at the last 2 positions of the 
string.  This would also match :
RewriteCond  %{ENV:HTML_TST} .*
and this
RewriteCond  %{ENV:HTML_TST} \w+

> This meets my requirement of matching any of the members of
> a list, but appears to be contrary to the documentation.
> 

No, it matches the documentation perfectly.
You are just interpreting wrongly the results that you see.

In RewriteCond,

TestString is a string (possibly after replacement/interpolation of 
variables like %{REMOTE_HOST})

CondPattern is a pattern  (into which you cannot interpolate variables)


What are you really trying to do ?
Can you give a real example ?


If you want to use the values of shell-level environment variables, then 
presumably you set these environment variables somewhere, before you 
invoke the script which starts Apache.
If you want to modify these values, you thus have to edit some script.
Then why do you not just edit httpd.conf ?
Or, use "Include" to include another file in httpd.conf at startup, and 
modify the content of that other file before you restart Apache.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message