[Zope] Apache/Zope mass name based virtual hosting

Evan Simpson evan@4-am.com
Thu, 08 Nov 2001 11:08:38 -0500


Mark Langkau wrote:

> Assume our domain is example.com. Internal DNS will be set to send
> *.test.example.com to 192.168.1.1 so all hosts matching that pattern go
> to real host "test.example.com."  I would like "mark.test.example.com"
> to map to "/site/mark" and "beta.test.example.com" map to "/site/beta"
> inside Zope.

There may well be other ways to do this, but this is the one that first 
occurred to me:

<VirtualHost xx.xx.xx.xxx>
  ServerName test.example.com
  ServerAlias *.test.example.com
  RewriteEngine On
  RewriteCond  %{HTTP_HOST}  ^([^.]+)\.test\.example\.com$
  RewriteRule ^/(.*) 
http://localhost:8080/VirtualHostBase/http/%{HTTP_HOST}:80/site/%1/VirtualHostRoot/$1 
[P,L]
</VirtualHost>

This is untested, but should be roughly correct.  The last rewrite rule is 
meant to be a single line of text, not three.  You must have a VHM installed 
in the Zope root.

Cheers,

Evan @ Zope