In a new site, with multiple domains, I have a problem. First the several websites with their own store view:
shop.mydomain.org, code shop
retail.mydomain.org, code retail
*.mydomain.org, code base
The base_url for all these stores is set to {{base_url}}
since the last one is dynamic. In a .htaccess
file, the code is set, ie:
RewriteCond %{HTTP_HOST} ^shop.mydomain.*$
RewriteRule ^ - [E=MAGE_RUN_TYPE:website,E=MAGE_RUN_CODE:shop] [L]
When visiting ie shop.mydomain.org
the first time after clearing the cache, everything works fine. The base_url is set to shop.mydomain.org
. Without clearing the cache and continueing on shop.mydomain.org
, the base_url is still okay.
Still without clearing the cache, when I visit retail.mydomain.org
, there is a problem with the base_url. On this domain, the base_url is the same as for shop.mydomain.org
, when I would expect it to change to retail.mydomain.org
.
I know I can change the base_url in the configuration to shop.mydomain.org
and retail.mydomain.org
solving my problem for these 2 domains. But, the last domain (*.mydomain.org
), can't be set to a specific base_url. All must work with a template in which an image is loaded based on the * part in the domain.
What I've tried:
In Mage_Core_Model_Store->getBaseUrl()
, change line
$this->_baseUrlCache[$cacheKey] = rtrim($url, '/') . '/';
to
return rtrim($url, '/') . '/';
to prevent Magento from adding the url in cache.
And more or less the same in Mage_Core_Model_Website::getConfig()
; don't store the config value in cache if the path contains 'url'.
Both options didn't work. Does someone have a solution?