Magento News

 

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:

PHP:

  1. umask(0);
  2.  
  3.     switch($_SERVER[‘HTTP_HOST’]) {
  4.  
  5.      case ‘first-store.com’:
  6.      case ‘www.first-store.com’:
  7.         Mage::run(‘store1′, ‘store1′);
  8.      break;
  9.  
  10.      case ‘second-store.com’:
  11.      case ‘www.second-store.com’:
  12.         Mage::run(‘store2′, ‘store2′);
  13.      break;
  14.  
  15.  
  16.      case ‘third-store.com’:
  17.      case ‘www.third-store.com’:
  18.         Mage::run(‘store3′, ‘store3′);
  19.      break;
  20.    
  21.      default: //run the default store if for some reason the above hasn’t worked.
  22.         Mage::run();
  23.      break;
  24.       }

Possibly Related Posts:


 

Leave a Reply