[Zope] Virtual hosting - help!

Mehmet Yousouf mehmety@auslin.com.au
15 Jul 2001 12:41:32 +1000


Hi, I've got virtual hosting working on my test system by following the
steps outlined by Alan Capesius -
http://twsite.bizland.com/twzop0015.htm
It works well but it took me a while to work out that it did work - I'm
in Australia and have .com.au sites and I think the site access rule is
set for only one dot (.com). I'm not very good with this string split
stuff sooo... can someone give me some pointers to allow for all
contingencies (.com and .com.au)?
AccessRule:
#############################
<dtml-try>
<dtml-let
hostname="_.string.split(_.string.lower(_.string.split(HTTP_HOST,':')[0]),'.')[-2:]" 
          domainname="hostname[0] + '.' + hostname[1]" 
          vhmcode="VHosts.gethostfolder(_.None, _, host=domainname)">

<dtml-if "vhmcode<>'NULL'">
<dtml-if "_.string.split(_.string.lower(PATH_INFO),
'/')[-1:]==['manage'] or 
            _.string.split(_.string.lower(PATH_INFO),'/')[-1:]==['manage_main'] or 
            _.string.split(_.string.lower(PATH_INFO),'/')[-1:]==['manage_workspace'] ">
<dtml-if "TraversalRequestNameStack[-2:]<>[vhmcode,'VHosts']">
<dtml-call
"REQUEST['TraversalRequestNameStack'].extend([vhmcode,'VHosts'])">
</dtml-if>
<dtml-else>
<dtml-call "REQUEST['TraversalRequestNameStack'].extend(['VHM',
vhmcode,'VHosts'])">
</dtml-if>
</dtml-if>

</dtml-let>
<dtml-except> </dtml-try> 

#########################################
Any help is appreciated.

Regards, Mehmet