httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Trutwin <j...@trutwins.homeip.net>
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" <joshua@slive.ca> 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]

Thanks,

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,

Josh

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