Re: RewriteMap questions

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

 



On Wed, 30 May 2007 22:29:53 -0400
"Joshua Slive" <joshua@xxxxxxxx> 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@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