[nzlug] apache2 mod_vhost_alias query

Peter Butler peter.butler at 141.com
Tue Nov 28 15:42:36 NZDT 2006


Hi
> The problem I have is since *.co.nz has an extra "." seperator I cant seem to
> pattern match them both as there isn't much flexibility (sorely lacking nice
> regex in mod_vhost_alias) has anyone figured a way around this? Is there
> something else I should be using?
>   
You could try mod_rewrite, something like this (warning: I haven't 
tested this):

RewriteRule .* /var/www/vhosts/%{HTTP_HOST}/htdocs/%{REQUEST_URI}

You can use fairly complex regular expressions in mod_rewrite, and it 
also allows very complex actions to be specified.  In fact now that I 
look at it, the mod_rewrite examples contain something very similar to 
what you need:

http://httpd.apache.org/docs/2.0/rewrite/rewrite_guide.html#uservhosts

Cheers

Peter




More information about the NZLUG mailing list