httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jsl...@gmail.com>
Subject Re: [users@httpd] mod_rewrite mass virtual hosting and aliases
Date Tue, 06 Dec 2005 14:43:58 GMT
On 12/6/05, gregory duchesnes <gregory@icilalune.com> wrote:
> Anyone's got an idea, i'm still stuck on this one...

> > # define the map file
> > RewriteMap vhost txt:/www/conf/vhost.map
> >
> > # deal with aliases as above
> > RewriteCond %{REQUEST_URI} ^/icons/
> > RewriteCond %{REQUEST_URI} ^/cgi-bin/
> > # if folder exists as a master domain
> > RewriteCond /var/www/hosts/${lowercase:%{SERVER_NAME}}/web ^(.+)$
> > # do the magic
> > RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/web/$1 [S=1]|
> > # else redirect to the master domain
> > RewriteCond ${vhost:%1} ^(/.*)$
> > RewriteRule ^(.*)   http://%1/$1  [QSA,L,R=301]

I don't really understand the logic in the above.  What I think you
want is something more like this:
# First canonicalize the hostname using the vhost alias map and
external redirects
# If the lower-cased server-name isn't in the map, then don't do anything
RewriteCond ${vhost:${lowercase:%{SERVER_NAME}}|default} !=default
RewriteRule (.*) http://${vhost:${lowercase:%{SERVER_NAME}:%1}$1 [R=301,L]
# Now interpolate the canonical vhosts, excluding some directories
RewriteCond %{REQUEST_URI} ^/icons/
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/web/$1

But in the end, you're really going to have to find your way through
the RewriteLog.  There is no other way to make sure you know what is
happening.

Joshua.

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