Magento MultiStore setup

Article ID #1164
Revision: 1.2
Last update: 2011-11-09

Basic information on setting up MultiStore Magento configuration is provided in the following articles:

 

To setup multistore configuration please use the following steps:

  1. Backup your current configuration/database
  2. Create all store views / stores / websites at System > Manage Stores screen, remember the code fields entered for every website, store or store view. It will be required to use the code to route requests at step 3.
    Please note, that every website should have at least one active store and every store needs at least one store view enabled.
  3. Change index.php file of your Magento installation, find the following lines in index.php:
            $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
            $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
    and replace these lines using the following code as a sample:
    switch($_SERVER['HTTP_HOST']) {
    
        case 'example.com':
        case 'www.example.com':
        case 'example.magenting.com':
            Mage::run('example', 'store');
        break;
    
        case 'computers.example.com':
            Mage::run('computers', 'website');
        break;
    
        case 'tvset.example.com':
        case 'tvsets.example.com':
            Mage::run('tvsets', 'website');
        break;
    
        default:
            $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
            $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
    
            Mage::run($mageRunCode, $mageRunType);
        break;
    }
    In the sample code above domains example.com, www.example.com, example.magenting.com are routed to store with example code, domain computers.example.com is routed to website with computers code, domains tvset.example.com and tvsets.example.com are routed to website with tvsets code. All rest requests are routed to default website and default store view.
  4. Add all domains used in the multistore setup to your instance
  5. Configure every Store view / Store / Website as you need to under corresponding configuration scope:



    • Setup basic settings, such as Locale, Design, logo, currency
    • Create root categories for every new store at Catalog > Manage categories page (root categories are usually used as a top menu for every store)
    • Assign root categories to stores at System > Manage Stores screen
    • Ensure that correct Base URL is set for every configuration scope, for changing Base URL please refer to this article
  6. Reindex all indexes at System > Index Management
  7. Ensure that every store / domain is opened properly in browser

 


Did this article help you solve your issue?


Average rating: 4.38 (16 votes)

completely useless 1 2 3 4 5 most valuable

Tags: ,