Index: qg.canonicalurl/trunk/qg/canonicalurl/__init__.py
===================================================================
--- qg.canonicalurl/trunk/qg/canonicalurl/__init__.py	(revision 485)
+++ qg.canonicalurl/trunk/qg/canonicalurl/__init__.py	(revision 487)
@@ -1,18 +1,22 @@
 #
 from ZPublisher.HTTPRequest import HTTPRequest
+from ZPublisher.BaseRequest import quote
 
-from ZPublisher.BaseRequest import BaseRequest, quote
 def physicalPathToURL(self, path, relative=0):
     """ Convert a physical path into a URL in the current context """
     url = self['SERVER_URL']
+    proto = url.split('://')[0]
+
     if not type(path) == type(''):
-        ps = '/'.join(path)
-    else:
-        ps = path
-    if ps.startswith('/www'):
-        url = "http://bipp.quintagroup.com"
-        if ps.startswith('/www/programs/energy-forum'):
-            url = "http://energy.bipp.quintagroup.com"
-            path = ps[len('/www/programs/energy-forum'):]
+        path = '/'.join(path)
+
+    path_domain_map = getattr(self, 'path_domain_map', ())
+    for subpath, domain in path_domain_map:
+        if len(path) >= len(subpath) \
+           and path.startswith(subpath):
+            url = "%s://%s" % (proto, domain)
+            path = path[len(subpath):]
+            break
+
     path = self._script + map(quote, self.physicalPathToVirtualPath(path))
     if relative:
@@ -21,3 +25,4 @@
         path.insert(0, url)
     return '/'.join(path)
+
 HTTPRequest.physicalPathToURL = physicalPathToURL
Index: qg.canonicalurl/trunk/qg/canonicalurl/adapters.py
===================================================================
--- qg.canonicalurl/trunk/qg/canonicalurl/adapters.py	(revision 485)
+++ qg.canonicalurl/trunk/qg/canonicalurl/adapters.py	(revision 487)
@@ -1,26 +1,61 @@
+from string import strip
+from time import time
+
 from zope.interface import implements
 from zope.component import adapts
+from plone.memoize import ram
 
-from interfaces import ICanonicalURLRoot, ICanonicalURL
-from config import CURL_PROPERTY_NAME
+from Products.CMFCore.utils import getToolByName
+from Products.CMFPlone.interfaces import IPloneSiteRoot
 
-class CanonicalURL(object):
+from interfaces import IDomainsMapExtractor
 
-    adapts(ICanonicalURLRoot)
-    implements(ICanonicalURL)
 
-    property_name = CURL_PROPERTY_NAME
+def cache_key(*args, **kwargs):
+     return time() // (60 * 60)
+
+
+class DomainsMapExtractor(object):
+    implements(IDomainsMapExtractor)
+    adapts(IPloneSiteRoot)
 
     def __init__(self, context):
         self.context = context
 
-    def setCanonicalURL(self):
-        if self.context.hasProperty(self.property_name):
-            self.context.manage_changeProperies(**{self.property_name:value})
-            return True
-        return False
+    def processData(self, value):
+        try:
+            pd_maps = map(lambda x: map(strip, x.split('::')), value)
+        except:
+            pd_maps = ()
+        else:
+            pd_maps.sort(lambda x,y: len(y[0])-len(x[0]))
+        return pd_maps
 
-    def getCanonicalURL(self):
-        return self.context.getProperty(self.property_name, 
-            d=self.context.original_absolute_url())
-            #d=self.context.absolute_url())
+
+    @ram.cache(cache_key)
+    def getDomainsMap(self):
+        """ Return sorted by sybpath length tupple
+            of (subpath, domain name) tuple.
+        """
+        portal = getToolByName(self.context, 'portal_url').getPortalObject()
+        pd_maps = portal.getProperty('path_domains_map', ())
+        return self.processData(pd_maps)
+
+    def setDomainsMap(self, value):
+        """ Set tupple of (subpath, domain name) tuples
+        """
+        if value:
+            prepared_value = self.processData(value)
+            portal = getToolByName(self.context, 'portal_url').getPortalObject()
+
+            if not portal.getPropertyType('path_domains_map') == 'lines':
+                if not portal.hasPropertyType('path_domains_map'):
+                    portal.manage_addProperty('path_domains_map', [], 'lines')
+                else:
+                    raise Exception("Wrong types of 'path_domains_map' " \
+                                    "portal property - should be list type")
+
+            update_value = ['::'.join(l) for l in prepared_value]
+            portal._updateProperty('path_domains_map', prepared_value)
+
+
Index: qg.canonicalurl/trunk/qg/canonicalurl/config.py
===================================================================
--- qg.canonicalurl/trunk/qg/canonicalurl/config.py	(revision 485)
+++ qg.canonicalurl/trunk/qg/canonicalurl/config.py	(revision 487)
@@ -1,2 +1,1 @@
-CURL_PROPERTY_NAME = 'canonical_url'
-DOES_PATCH_TRAVERSABLE = 0#True
+DOES_PATCH_TRAVERSABLE = 1#True
Index: qg.canonicalurl/trunk/qg/canonicalurl/configure.zcml
===================================================================
--- qg.canonicalurl/trunk/qg/canonicalurl/configure.zcml	(revision 485)
+++ qg.canonicalurl/trunk/qg/canonicalurl/configure.zcml	(revision 487)
@@ -4,18 +4,11 @@
     xmlns:genericsetup="http://namespaces.zope.org/genericsetup">
 
-    <!-- Declare interface -->
-    <interface interface=".interfaces.ICanonicalURL" />
+    <adapter factory=".adapters.DomainsMapExtractor" />
 
-    <!-- Make any Plone Site and Zope root Canonical URL Root provider -->
-
-    <class class="Products.CMFPlone.Portal.PloneSite">
-        <implements interface=".interfaces.ICanonicalURLRoot" />
-    </class>
-
-    <class class="OFS.interfaces.IApplication">
-        <implements interface=".interfaces.ICanonicalURLRoot" />
-    </class>
-
-    <adapter factory=".adapters.CanonicalURL" />
+    <subscriber
+        for="Products.CMFPlone.interfaces.IPloneSiteRoot
+             zope.app.publication.interfaces.IBeforeTraverseEvent"
+        handler=".subscribers.add_domains_map"
+        />
 
     <genericsetup:registerProfile
Index: qg.canonicalurl/trunk/qg/canonicalurl/interfaces.py
===================================================================
--- qg.canonicalurl/trunk/qg/canonicalurl/interfaces.py	(revision 485)
+++ qg.canonicalurl/trunk/qg/canonicalurl/interfaces.py	(revision 487)
@@ -1,19 +1,11 @@
 from zope.interface import Interface
 
-class ICanonicalURLRoot(Interface):
-    """Marker interface for canonical URL provider
-    """
+class IDomainsMapExtractor(Interface):
 
-class ICanonicalURL(Interface):
-    """Get/Set Canonical URL property value
-    """
-    def getCanonicalURL():
-        """Return canonical URL:
-           calculated from 'canonical_url' property
-           on ICanonicalURL marked object and relative
-           path from it OR absolute_url otherwise.
+    def getDomainsMap():
+        """ Return sorted by sybpath length tupple
+            of (subpath, domain name) tuple.
         """
-
-    def setCanonicalURL():
-        """Set canonical URL
+    def setDomainsMap():
+        """ Set tupple of (subpath, domain name) tuples
         """
Index: qg.canonicalurl/trunk/qg/canonicalurl/subscribers.py
===================================================================
--- qg.canonicalurl/trunk/qg/canonicalurl/subscribers.py	(revision 487)
+++ qg.canonicalurl/trunk/qg/canonicalurl/subscribers.py	(revision 487)
@@ -0,0 +1,13 @@
+from interfaces import IDomainsMapExtractor
+
+def add_domains_map(context, event):
+    """Add to request PATH-DOMAIN map.
+    """
+    pd_map = None
+    extractor = IDomainsMapExtractor(context, None)
+    if extractor is not None:
+        pd_map = extractor.getDomainsMap()
+
+    if pd_map is not None:
+        event.request.set('path_domain_map', pd_map)
+
