Your shopping cart is empty. Browse our Store

Magento

Open Source eCommerce Evolved

Multiple website setup

Last modified by Moshe on Wed, October 3, 2007 14:49
Source|Old Revisions  

There are many ways multiple stores can be implemented. it could be:

- subdomains in different document roots,
- subdomains in same document root,
- subfolders,
- folder aliases,
- etc.

To make it the most flexible we have made so the user will decide on the logic of which store will be launched from specific location.

All the logic should be done from index.php that is being ran.

As you can see in default index.php we have:

  1. Mage::run('base');

That means that ‘base’ store will be invoked.

In the demo download package we have multiple stores defined by subfolder they’re in.
For example German store is in /de/index.php:

  1. Mage::run('german');

If you have same index.php serves as entry point for few stores, the store code will have to be calculated from environment, for example host name:

  1. $host = explode(':', $_SERVER['HTTP_HOST']);
  2. switch ($host[0]) {
  3. case 'german.example.com':
  4.   $store = 'german';
  5.   break;
  6.  
  7. default:
  8.   $store = 'base';
  9. }
  10.  
  11. Mage::run($store);

Please note that .htaccess should be copied to every folder index.php is in.

Related Tags:  multi store websitesubdomains



 

Popular Wiki Tags  |  View all

Professional Services from the Magento Team

Professional Installation from the Magento Team

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs
Sales: Call 877.832.5289 (North America) 310.295.4144 (International) to request a call-back.
© Copyright 2008 Varien. Magento is a trademark of Irubin Consulting Inc. DBA Varien    Privacy Policy|Terms of Service