You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Brian Hirt <bh...@me.com> on 2010/10/08 20:14:34 UTC
[users@httpd] mod_rewrite: use rewrite map in RewriteCond pattern?
Is there any way to accomplish something like the following?
RewriteMap hn txt:/apache/config/hostname.map
RewriteCond %{HTTP_HOST} ${hn:www} [NC]
Thanks!
---------------------------------------------------------------------
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
Re: [users@httpd] mod_rewrite: use rewrite map in RewriteCond pattern?
Posted by Brian Hirt <bh...@me.com>.
On Oct 8, 2010, at 12:19 PM, Eric Covener wrote:
> RewriteCond %{HTTP_HOST},${hn:www} ^([^,]+),\1
Eric,
Thanks for the pointer, it worked like a charm. Note to others, this doesn't appear to work with 1.3
--brian
---------------------------------------------------------------------
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
Re: [users@httpd] mod_rewrite: use rewrite map in RewriteCond pattern?
Posted by Eric Covener <co...@gmail.com>.
On Fri, Oct 8, 2010 at 2:14 PM, Brian Hirt <bh...@me.com> 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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org