Magento Multistore Setup in a Nutshell

One of the really cool features of Magento is the ability to easily setup a multistore on one installation of Magento. If you have never done it before though it can be a little tricky.

Here is very brief guide:

First create the stores. This is all done via the Magento administration.

System->Manage Stores

foreach store that you want, create a website, store and store view. Make a note of the codes as you need those in the code below.

Then in your index.php file have some code like this:

umask(0);

    switch($_SERVER['HTTP_HOST']) {

     case 'first-store.com':
     case 'www.first-store.com':
        Mage::run('store1', 'store');
     break;

     case 'second-store.com':
     case 'www.second-store.com':
        Mage::run('store2', 'store');
     break;


     case 'third-store.com':
     case 'www.third-store.com':
        Mage::run('store3', 'store');
     break;
    
     default: //run the default store if for some reason the above hasn't worked.
        Mage::run();
     break;
      } 

Tags: magentomultistore