How to configure/create multiple Magento storefronts?

Apart from numerous ways to set up multiple Magento stores that all share the same codebase and backend, we are providing you with the simplest one. Else what method you use depends on your needs.

Aliasing Method of Magento storefronts:

[This method may be similar to Parked Domain approach in C panel.]

1. Define a server alias in a webserver config file.

For Apache:

 <VirtualHost .. : ..>
 ...
 ServerName ....
 //add below entry in existing virtual host config
 ServerAlias new_store_domain-name
 ...
 </VirtualHost>

For Nginx:

 server {
 ...
 //add new entry after existing server name on same line with space in between
 server_name ... new_store_domain.name ;
 ...
 }

2. Creating a storefront.

  • Log in to the Magento Administrator Panel.
  • In the top menu, go to Catalog > Manage Categories.
  • Click Add Root Category.
  • In the Name field, enter your new store name.
  • Under Is Active, select Yes.
  • Under Display Settings, in Is Anchor, select Yes, and select Save Category.
  • Go to System > Manage Stores.
  • Click Create Website.
  • In the Name field, enter your new store name.
  • In the Code field, enter a unique string without spaces and click Save Website. Remember this Code as we use this later for further configuration.
  • Click Create Store.
  • In the Website field, select the website that you just created.
  • In the Name field, type a name for your store.
  • In the Root Category field, select the root category that you created above or use the default Root Category if you skipped ahead. Click Save Store.
  • Click Create Store View.
  • In the Store field, select the store you just created. In the Name field, give your view a name. This is typical “English.”
  • In the Code field, enter a unique string to identify the store view. Change the Status to Enabled. Click Save Store View.
  • Go to System > Configuration.
  • In the Current Configuration Scope field, select the website that you just created.
  • Select the Web menu option, and click to expand the Unsecure and Secure sections, respectively.
  • For each section, clear the Use Default checkbox next to the Base URL and type the URL for your store, including the trailing slash. Click Save Config.
Magento- Hosting

3. Add following block in “index.php” file in Magento hosting directory.

Open up the index.php file for Magento and look for this line (it’s the last line of the file):

 > Mage::run($mageRunCode, $mageRunType);

…and right before this, add the following code:

 switch($_SERVER['HTTP_HOST']) {
 case '':
 $mageRunCode = '<store_code>';
 $mageRunType = 'website';
 break;
 }

If you have more than two storefronts, you will need to add additional cases to the above code block, e.g.:

 switch($_SERVER['HTTP_HOST']) {
 case '':
 $mageRunCode = '<store_code1>';
 $mageRunType = 'website';
 break;
 case '':
 $mageRunCode = '<store_code2>';
 $mageRunType = 'website';
 break;
 }

e.g.- Suppose an existing Magento Server is Running over “www.test.com” and we are adding another new storefront named as “magento.test.com” then above entry is like

switch($_SERVER['HTTP_HOST']) {
case 'magento.test.com':
$mageRunCode = 'magento_code';
$mageRunType = 'website';
break;
}

You have successfully set up a Magento store. Repeat the steps above for any additional stores you wish to create.

Scroll to Top

We can help you. Right now.

Fast growing merchants depend ServerGuy for high-performance hosting. Experience counts. Let's get started.

Talk to a sales representative

USA / Worldwide

+1.714.2425683

India

+91.9852704704