httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Trutwin <>
Subject Re: [users@httpd] RewriteMap questions
Date Thu, 31 May 2007 13:40:30 GMT
On Wed, 30 May 2007 22:29:53 -0400
"Joshua Slive" <> wrote:

> > Out of curiosity - how would you use the hostname in the lookup
> > key?
> Adjust your db file to use host/path instead of just path as the
> key, and then:
> RewriteCond ${existing:%{HTTP_HOST}$1|NOT-FOUND} =NOT-FOUND
> RewriteRule ^/(.*) ${redirects:%{HTTP_HOST}$1} [L,QSA]


Here's what I'm currently doing:

In httpd.conf:

RewriteMap rewriter prg:/usr/local/bin/rewriter.php

In vhosts .htaccess file:

RewriteEngine On

RewriteRule .* ${rewriter:%{REQUEST_FILENAME}^%{REQUEST_URI}} [L,QSA]

I have to "pass" in the both of these so I can find the docroot for
the vhost then find the map file which will always be in the same
location for each vhost.

So far it seems to be doing ok.  I was going to add RewriteCond for
checking the the REQUEST_FILENAME actually exists, but I guess that
is an expensive check so I'm having the program handle this too.

Thanks again for your help,


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message