[Zope] Most efficient use of url rewriting and virtual host
monster.
Alec Munro
alecmunro at hfx.eastlink.ca
Wed Nov 12 16:17:00 EST 2003
Dylan Reinhardt wrote:
>On Wed, 2003-11-12 at 08:54, Alec Munro wrote:
>
>
>
>>I guess what I'm really looking for is a good explanation for virtual
>>host root, as well some insight in how zope generates urls.
>>
>>
>
>All you need is to create a VHM instance. It doesn't actually matter
>what you call it.
>
>Let's say domain_name.com is hosted from here in the Zope hierarchy:
>
>/sites/domain_name
>
>Put this in domain_name's virtual host block in Apache (one line):
>
>RewriteRule ^/(.*)
>http://localhost:8080/VirtualHostBase/http/www.domain_name.com:80/sites/domain_name/VirtualHostRoot/$1 [L,P]
>
>Reload Apache and you should be good to go.
>
>HTH,
>
>Dylan
>
>
>
>
Thanks for the response, but I have more specific problems than simply
getting it working.
The main problem I seem to have at the moment is that when I do the
above, so that I have the Virtual Host Root set up the way I want it,
then restrictedTraverse stops working.
I use it in many places, and when I have the VHR set, it seems like it
works from the root of the zope instance itself, so if I am traversing
("/HTML/somePage") it will give me a KeyError if I don't have this in
the root of my zope instance. What I assume is happening is that when I
use restrictedTraverse on a string that came from an absolute_url, then
the url is truncated when I'm using a VHM, and I get "/HTML/somePage"
instead of "/folder/xyz/HTML/somePage". Is there some way I can adapt
restrictedTraverse to root it in a certain directory? Or will I need to
prefix all my absolute_urls with the path to the parent folder. Or is
there a function like absolute_url that will disregard the VHR?
I know that was long, so thanks for reading.
Thanks,
Alec Munro
More information about the Zope
mailing list