Magento Multistore Setup on Localhost

Often developers use local server to test before deploying the code in the real server. Magento multi-store configuration is one of the strengths of Magento that sets up itself apart from many other free e-commerce framework. Here is the configuration guide to setup Magento multistore under the same domain on the localhost.

1. Localhost Configuration – Follow the following instruction for your localhost (if you yet to set up Magento on localhost, see previous article on how to setup Magento on localhost using AMPPS.
A. Create a directory under root. Say the name of the directory is localSubstore1. Copy index.php and .htaccess from the parent folder (root) and place in the substore1. Make the following changes in the .htaccess file.

SetEnvIf Host localhost MAGE_RUN_CODE=localSubstore1
SetEnvIf Host localhost MAGE_RUN_TYPE=website

B. Open index.php (under localSubstore1) and change the mageFilename as :

$mageFilename = ‘../app/Mage.php';

2. Magento Multistore Setup using Magento Admin dash board

Follow the instruction to set up Magento Multistore:
A. Create Category – After logging into Magento Admin panel, go to Catalog -> Categories -> Manage Categories and can create a new root category for your store. Note that Magento does not show the root category. So any category that needs to be displayed on the menu, needs to be under root category.
B. Create website – Go to System -> Manage Stores, click on create website.
Name : Name of the store website (eg. localSubstore1.com)
Code : Needs to match Apache configuration and directory (eg. localSubstore1)

C. Create Store – Go to System -> Manage Stores, click on create store.
Website – select the website you created in step B (localSubstore1.com)
Name – Name of the store view (e.g. localSubstore1)
Root Category – Select the root category you created in Step A from the drop down menu.

D. Create Store View – Go to System -> Manage Stores, click on create store view.
Store – select the store you created in step C (localSubstore1)
Name – Name of the store view (e.g. English)
Code – Code for the store view (e.g. localSubstore1_en)
Status – select Enable

(This section has been created following the article http://www.magentocommerce.com/knowledge-base/entry/tutorial-multi-site-multi-domain-setup)

3. Magento Multistore configuration – System Configuration

A. Go to System ->Configuration->web. The Base URL should be same as your localhost magenta setup.  You do not need to modify anything here.

B. Go to System->Configuration->Design.  Select the package and theme for your store website and store view.

4. Magento Multistore Homepage setup

Go to CMS->Pages.  Create a new home page for the store.

Select Page Information. Fill

Page Title – Name of your home page title (e.g. Home page-Local Store)

url key : url key of the store (e.g home/localSubstore1)

Store view : store view of the store (e.g. English)

Content – Add content you desire.

Design – Select the layout and the Custome theme you selected for your store.

You are all done.  Now you can access your store by going

http://localhost/your-localMainstore/localSubstore1/

One thought on “Magento Multistore Setup on Localhost

Leave a Reply