Author: Dr. Volker Liebenberg, 2003/09/04
If many domains within a ZOPE/ZMS instance shall be maintained, virtual hosts are to be implemented and corresponding rewrite rules must be configured.
In principle this is possible within ZOPE, but due to performance and flexibility it is recommendable to make this configuration directly in the Apache.
The following example describes a portal (www.portal.de) presenting the contents of different clients (instanz1.de instanz2.de etc.) like an overview and refering to them for further information.
Access to the instances´ hierarchy is carried out in each case via an own domain. The configuration of the virtual hosts with rewrite rules happens directly in the httpd.conf:
RewriteEngine On RewriteRule ^PfadINSTANZ1(.*) http://www.instanz1.de:80$1/ [L,NE] RewriteRule ^PfadINSTANZ2(.*) http://www.instanz2.de:80$1/ [L,NE] RewriteRule ^PfadINSTANZ3(.*) http://www.instanz3.de:80$1/ [L,NE] RewriteRule ^(.*) http://217.160.211.236:8080/VirtualHost\ Base/http/www.portal.de:80/live/ROC/VirtualHostRoot$1 [L,P,NE]
RewriteRule ^PfadINSTANZX(.*) ...
Requests with the corresponding URL path of the instance are transmitted to the related domain. L (last rule) stops the processing of further reWrites. NE prevents that special characters are coded differently, e.g. in case of search requsts(wildcards).
RewriteRule ^(.*) http://217.160.211.236:8080/VirtualHostBase/ http/www.portal.de:80/live/ROC/VirtualHostRoot$1 [L,P,NE]
All other objects (^(.*) (=from beginning of the line any characters in unlimited number) are handed over to the Zope-Virtual Host Monster (VHM). The VHM changes the links within the HTML pages. The parameter forces an internal Proxyrequest and that way masks the long URL handed over to the VHM.
The reWrite rules that are to be used are correspondent to those of the portals. This is neccessary to achieve a correct addressing e.g. in case of internal links.
When rewriting you have to take care that the entire ZOPE path is taken over without any changes in order to avoid faulty addressing of objects.
It is possible to use shorter paths, but this requests more complex reWrite rules.
The used flag means:
L: End of the rule processing (in case of hits)
NE: No coding of special characters
P: force internal Proxyrequest and mask with it the reWrite URL
More about the topic: