Re: mod_rewrite: use rewrite map in RewriteCond pattern?

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

 



On Fri, Oct 8, 2010 at 2:14 PM, Brian Hirt <bhirt@xxxxxx> wrote:
> Is there any way to accomplish something like the following?
>
> RewriteMap hn txt:/apache/config/hostname.map
> RewriteCond %{HTTP_HOST}        ${hn:www} [NC]
>

you can't have variables of any kind in the regex, because it's only
compiled once not per-request.

You can put both the variable and the HTTP_HOST in the test string
(first parm) with some separator then make sure they're equal by using
an internal backreference instead of one fluffed up my rewrite itself:

e.g.

RewriteCond %{HTTP_HOST},${hn:www} ^([^,]+),\1

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