How to Set Up Multiple Store Fronts with 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 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:
Go to Catalog→Manage Categories in the top menu.
Click Add Root Category.
In the Name field, enter your new store name. Under Is Active select Yes.
In the Name field, enter your new store name. In the Code field, enter a unique string without spaces.
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.
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.
Go to System→Configuration.
In the Current Configuration Scope, select the Website you just created.
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.
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 220.127.116.11.
Method 1: Separate Directories for Each Store (Using Secondary Domains)
ln -s /home/example/example.com/html/app/ app
ln -s /home/example/example.com/html/includes/ includes
ln -s /home/example/example.com/html/js/ js
ln -s /home/example/example.com/html/lib/ lib
ln -s /home/example/example.com/html/media/ media
ln -s /home/example/example.com/html/skin/ skin
ln -s /home/example/example.com/html/var/ var
Method 2: Shared Directory for All Stores (Using Pointer Domains)
Use the following guide to create a Pointer Domain for your new store:
SetEnvIf Host .*newstore.* MAGE_RUN_CODE=newstore
SetEnvIf Host .*newstore.* MAGE_RUN_TYPE=website
If SetEnvIf Doesn’t Work
Try the following:
Edit the .htaccess file in the document root of your Magento Installation.