Multiple websites on Magento 1.4 single installation

Last modified by Moshe on Fri, December 3, 2010 17:09
Source|Old Revisions  

This is an old revision of the document!

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 '':
  4.   $store = 'german';
  5.   break;
  7. default:
  8.   $store = 'base';
  9. }
  11. Mage::run($store);

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