[Zope] - Using Zope with PCGI on a web hosting service

Kevin Dangoor kid@ans.net
Fri, 29 Jan 1999 10:45:01 -0500


Hi,
	I just wanted to pass along some of what I've learned trying to get
Zope working properly on a web hosting service where I don't have any
admin level access to Apache.

	Assuming the hosting company has mod_rewrite installed (which pair, the
company I'm using, does), you should be able to get things going.
mod_rewrite is not as efficient on a directory-level basis, but it does
at least function.

	The Rewrite config lines listed in WEBSERVER.txt need to be added to a
.htaccess file in your document tree. There is a change that you need to
make, however.

RewriteEngine on
RewriteCond %{HTTP:Authorization}  ^(.*)
RewriteRule ^Zope.cgi/(.*) -
[e=HTTP_CGI_AUTHORIZATION:%1,t=application/x-httpd-cgi,l]

Note that the RewriteRule (and the line below it) are on one line.

When using mod_rewrite from .htaccess, the URL you are applying the
RewriteRule to is relative to directory you're in. (In WEBSERVER.txt, it
lists ^/Zope/, but the leading / is not necessary in this context.)

The RewriteRule I've supplied above does not actually rewrite the URL.
It just passes through the HTTP_CGI_AUTHORIZATION variable. I had to do
this because of another side effect of using mod_rewrite from .htaccess.
If I had made the RewriteRule look like this:
RewriteRule ^z/(.*) /path/to/Zope.cgi
[e=HTTP_CGI_AUTHORIZATION:%1,t=application/x-httpd-cgi,l]

Zope would see its URL as http://www.yoursite.com/Zope.cgi/, even though
you accessed it from http://www.yoursite.com/z/. Consequently, you can't
use the management interface, because Zope tries to load things through
/Zope.cgi/ instead of through /z/, therefore the RewriteRule doesn't get
touched and the authorization information doesn't make it through. Thus
far, I haven't had a chance to play with the environment variables to
try to fix this. (Though I'm sure it is fixable.)

Finally, one last caveat: you'll need an updated ZPublisher. mod_rewrite
tosses REDIRECT_ in front of a number of environment variables when used
with .htaccess. The changes to Publish.py remove the REDIRECT_
references.

If anyone has been using mod_rewrite like this and has any suggestions
on making things work cleaner, they'd be much appreciated.

Kevin

-- 
Kevin Dangoor
kid@ans.net / 734-214-7349