Re: [users@httpd] mod_rewrite mass virtual hosting and aliases

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

 



On 12/6/05, gregory duchesnes <gregory@xxxxxxxxxxxxx> 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@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