Re: Reverse RewriteCond?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux