I’m testing a multi-website configuration (1.1.7). Since i can’t modify the vhost settings (required so website a can access website b’s files), I’ve tried setting it up using $_SERVER[’SERVER_NAME’]. My index.php looks somewhat like this:
if($_SERVER['SERVER_NAME'] == 'www.domain-a.com') Mage::run('website-a', 'website');
elseif($_SERVER['SERVER_NAME'] == 'www.domain-b.com') Mage::run('website-b', 'website');
else Mage::run('website-global', 'website'); //www.domain-global.com
I’ve set up the stores (admin panel -> system -> manage stores) and did the website configuration (admin panel -> system-> configuration -> web). Nothing new here, everything works fine.
But here’s my first question: are there any known issues regarding my approach, using $_SERVER[’SERVER_NAME’] to determine what website to run?
My second question is regarding the catalog. I have one root catalog that basically belongs to domain-global.com. In domain-a and domain-b i only want to use part of the catalog so i disabled some categories for those websites. Now the problem is that the URL’s in the frontend of website-a and website-b, link to website-global’s domain. So as soon as i click a category at www.domain-a.com or www.domain-b.com, I end up at that category at www.domain-global.com. It does not change the store though, only the domainname in the URL. The other links, like account, wishlist, etc, work fine (remain the same domain name).
Is this because of my approach using $_SERVER[’SERVER_NAME’], or is there something else i’m doing wrong? A possible solution is creating 3 root catalogs. But that might create inconsistency in the catalogs.
Any help in the right direction is much appreciated!