[Zope] Newbie Questions

Adam Warner lists@consulting.net.nz
03 Feb 2002 14:50:42 +1300


On Sun, 2002-02-03 at 14:32, Gary Learned wrote:
> Thanks Adam, I understand the acquisition parts, and your diagram makes
> perfect sense. It does raise one other question though...In order to
> have www.specificwebsite.xxx equate to
> /websites/specificwebsite/baseofsite/ I need to have an external proxy
> or redirector, true? As I understand it, there is no way to have zope
> itself do this.

I won't say there is no way but yes the best way seems to be to use
Apache on port 80 to redirect to the Zope server (9673 in my case).
Here's an example from my Apache httpd.conf configuration file:

<VirtualHost *>
ServerName www.consulting.net.nz
DocumentRoot /var/www/consulting/
<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteLog /var/log/apache/rewrite_log
	RewriteLogLevel 0
	RewriteRule ^/(.*) http://www.consulting.net.nz:9673/consulting/site/VirtualHostBase/http/www.consulting.net.nz:80/VirtualHostRoot/$1 [P]
</IfModule>
</VirtualHost>

You will see that the the website root is currently in /consulting/site/
on the Zope web server. The trick is to use add a "Virtual Host Monster"
in this subdirectory. Then everything works. This is a far better way
than adding a "SiteRoot" which can lead to lots of annoying problems:

 Add SiteRoot

This will change URLs generated by all objects within the same container
as the SiteRoot. If a Base is specified (or a SiteRootBASE value can be
found) then it will replace the host:port/script portion of generated
URLs. If a Path is specified (or a SiteRootPATH value can be found) then
it will replace the remainder of each URL.

Values affected include DTML variables starting with URL or BASE, and
the absolute_url() methods of objects.

If Base is not set, the SiteRoot will first attempt to acquire
SiteRootBASE and then search the REQUEST for it. The same holds for Path
and SiteRootPATH.

Base (if specified) should always start with "http://"


Regards,
Adam