How to Set Up Multiple Store Fronts with Magento

Published On November 15, 2012 | By Hans-Eirik Hanifl | Magento

How to set up multiple store fronts in Magento

This tutorial will walk you through the setup of multiple store fronts running off one Magento back-end and database. Once we have set the store up in the database we will be exploring two methods of creating the store fronts on the physical server. The method you select will have to do with server requirements, how you wish your store to operate, and, to some extent, budgetary constraints.

Using separate directories for all stores
Works for all versions of Magento.

Using a shared directory for all stores
This is my preferred method. I find it to be the most expedient when working with a large amount of store fronts. This method works on all versions of Magento higher than 1.4

Create a New Store in Magento

To start off, the first step in setting up multi-store functionality is to create the new store(s) in the Magento Admin application. Follow the steps below to create a new store:

Log in to the Magento Admin Panel.
If you want your new store front to use your existing root category, you may skip the category creation step.
Go to Catalog→Manage Categories in the top menu.
Click Add Root Category.
Create a new root directory for your multi-store Magento

In the Name field, enter your new store name. Under Is Active select Yes.

Click the Display Settings tab. Under Is Anchor, select Yes. Then select Save Category.
Setting the correct display settings for your new store root category
  1. Go to System→Manage Stores.
    Manage the store fronts in the Magento back-end
Click Create Website.
In the Name field, enter your new store name. In the Code field, enter a unique string without spaces.
Then click Save Website.
Set up your new Magento website

Click Create Store.
In the Website field, select the website you just created. In the Name field, enter a name for your store. In the Root Category field, select the Root Category you wish to use for the store front. Then click Save Store.
Create a new Magento store
Click Create Store View.
In the Store field, select the store you just created. In the Name field, give your view a name (typically “English”). In the Code field, enter a unique string to identify the store view. Change the Status to Enabled. Then click Save Store View.
Create a new store view inside your Magento back-end
Go to System→Configuration.
In the Current Configuration Scope, select the Website you just created.
Configure new magento store settings
Select the Web menu option, and expand the Unsecure and Secure sections by clicking them.
For each section, deselect the Use Default box next to the Base URL and enter the URL for your store, including the trailing slash. When you are done, click Save Config.
Set up the store configuration for your new Magento multi-store front

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

Configure the Server to Load the New Store

Now that you have your new store created, you need to configure the server to load the right store. There are several methods for doing this. We present the two most popular methods below. The first method is the older of the two, and will work for any version of Magento. The second method takes advantage of changes made to the index.php file introduced in version 1.4.0.1.

Method 1: Separate Directories for Each Store (Using Secondary Domains)

Ensure that the domain name you wish to use is pointing to the server.
Use the following guide to create a Secondary Domain for your new store.
Using either FTP or SSH, copy the .htaccess and index.php files from your Magneto Installation to the document root of your new domain.
Open the index.php file that you just copied over and edit the last line of the file as follows:
Change newstore to the Code you created when you set up the new website above. 

 

Finally, using SSH, create the following symbolic links in the document root of your new domain:
Replace the path below with the full path to the document root of your Magento Installation.

 

You have successfully set up your secondary domain to work with Magento. You may now load your new domain in your browser and begin developing your new store.

Method 2: Shared Directory for All Stores (Using Pointer Domains)

Ensure that the domain name you wish to use is pointing to the server.
Use the following guide to create a Pointer Domain for your new store:
Make sure the Pointer Domain is pointing at the Primary Domain where your Magento Installation is located.
Edit the .htaccess file in the document root of your Magento Installation and enter the following just above the line RewriteEngine On:
Ensure that .*newstore.* matches the domain name of your new store.
Ensure that MAGE_RUN_CODE matches the Code you wrote down when you created the new website above.

 

You have successfully set up your pointer domain to work with Magento. You may now load your new domain in your browser and begin developing your new store.

If SetEnvIf Doesn’t Work

Try the following:

Edit the .htaccess file in the document root of your Magento Installation.

Enter the following right below the line #RewriteBase /magento/:
Ensure that .*newstore\.com matches the domain name of your new store.
Ensure that MAGE_RUN_CODE matches the Code you wrote down when you created the new website above.

 

Like this Article? Share it!

About The Author

is a forward thinking e-commerce and marketing consultant. As an advocate for the free exchange of knowledge, he founded E-Commerce Gorilla as a place where like-minded individuals can ask questions and share their expertise on practical solutions in the area of e-commerce and marketing. He is the owner of TRM Marketing and an avid supporter of the open source community.

Leave a Reply