Magento Multiple Store Setup Instructions

Summary of Steps

  1. Point nameservers for each store’s domain.
  2. Create add-on domains for each store.
  3. Create a single MySQL database.
  4. Upload and install Magento under main domain only.
  5. Login to admin area for new installation.
  6. Rename default root category.
  7. Create additional root categories for each store.
  8. Rename default Website, Store and Store view.
  9. Create an additional Website, Store and Store View for each domain/store, assign root categories.
  10. Change the web configuration URLs for each additional „scope“ under the Unsecure and Secure areas.
  11. Copy the „.htaccess“ and the „index.php“ files to each additional Addon Domain.
  12. Make all adjustment to the appropriate „.htaccess“ and „index.php“ files.

Special Notes: You can create as many extra stores was you want, each can have its own domain. However, I personally have NOT been able to get any Multiple Store configuration correctly setup and working for subdomains or subfolders ( -OR- Therefore, the instructions provided here are for multiple stores configured on the root of each domain only. Also, the instruction given below are for Magento 1.7 or better, but future version may make these instructions obsolete. In addition, any browser will do, just make sure you turn off the caching features. These are typically located under the developer’s menu or preferances of your browser. Not doing so may result in the caching of pages and you may not be seeing the latest page views.

Steps 1-5

If you already have your Addon Domains setup and magento installed you can go to Step 6. Just remember, you only need a single installation of Magento under the main website.

From your registrar, point each of your purchased store domains to the specific nameservers provided by your web hosting service. Example nameservers: ns1234.yourhost -and- ns1235.yourhost. In my case I purchased a .COM domain which I am using as a demo website for a Content Management System (CMS) installation. For my main store however, this is where the single Magento installation will be located, I purchased a .INFO domain and three other addon stores which will be located at .BIZ, .NET, and .ORG. So I will have four sample stores in total plus my front end .COM website (which is not part of these instruction here).

From your hosting cPanel, create an „Addon Domain“ for each store. In my case I created the addons for my .INFO, .BIZ, .NET, and .ORG domains. This procedure will automatically create a subfolder for each domain in your root account, the .COM domain in my case. Remember however, later you’ll perform only a single Magento installation under one of the selected domains, this will be your main store, mine is located at the .INFO domain.

From your hosting cPanel, create a MySQL Database for the main store’s installation. Only a single database will be needed as all stores will pull their data from this one database.

From your hosting cPanel, open the file manager to the main store’s domain folder, .INFO in my case, and upload the Magento install file, then perform an Extract. Now all the files should be located in the respective root domain for your main store, if not then move all file to the public WWW root.

From your browser, load the main store’s domain address and run the Magento installer. Yes, you CAN activate the „Use mod_rewite“ feature.

From your browser, login to your new main store’s admin area, .INFO in my case.

Steps 6-7

Go to „Catalog > Manage Categories“. Once there you’ll see a menu like the one below but with only a single root „Default Category“ already created.

Next, rename this default category. Name it after your main store’s domain name, .INFO in my case. Next, create a new root category for each store you plan to create. BTW, using the name of the domain here will make the breadcrumbs look good. For organizational purposes I have not done that here. Instead I have named my sample root categories after the domain extensions themselves, .INFO, .BIZ, .NET, and .ORG in this case (see above). Remember, my main store is .INFO, so later that will be my root category for that store. Products can belong to multiple categories and subcategories all at the same time.

Also when updating this root default category, and when creating new root categories for new addon stores, mark „Is Active“ to YES (see 1st example below), and under the „Display Settings“ tab, mark „Is Anchor“ to YES (see 2nd example below). Then save each new root category. I would fill-in the rest of the data later, lets get things up and running first.

Steps 8-9

Next, go to „System > Manage Stores“. Once there you’ll see a default Main Website, Main Store and Main Store View already setup. As you did under root categories, rename each of these defaults following the naming conventions we used when creating our root directories, do this for each domain store. In my example below I have already renamed and created all the items needed to complete my multiple store setup. But I will define a few of the aspects for you. After you have renamed the default Website, Store and Store View, you will then create a new set of defaults for each addon domain store like I have below. Remember, the .INFO is my main domain and thus will be my main website, store, and store view, it is where i placed my Magento installation.

When you’re done updating and creating all the sets here for your domains (Websites, Stores, Store Views), it is a good idea to return to this page here and double check your work. Each item on a row should belong together and follow the same naming scheme, if not then things could get confusing later. Always stick to a naming scheme of some kind to keep things organized, it will save you time later if you have to do any troubleshooting.

Under Website Information, „Code“ refers to the simple name utilized in the backend configurations for each website setup here, like a variable of sorts. It is a good idea to keep special characters out of the „code“ field, just in case. In the example below, the „Default Store“ dropdown will not be present when you’re first creating a new website, but rather shows after the fact, which is why you see it now, but you’ll settle this under the next „Store“ screen, so just ignore it for now.

When adjusting or creating a new store, here is where you select the appropriate Root Category that we setup earlier for each store.

When creating a new Store View it is good use the same Code as the one you used under the matching Website screen. Here is where you could create a new store view for each language and name it appropriately. Example: BIZ Store View English, BIZ Store View Spanish, BIZ Store View Klingon, etc …

Also, make sure you mark the Status as „Enabled“.

Step 10

From your browser, go to „System > Configuration“ located in the main menu bar. Next you’ll see the following general page. Select „Web“ from the submenu on the left.

Then open the „Unsecure“ and „Secure“ menus. We’ll come back to those ares in a minute.

Located in the upper left hand corner you’ll see the „Current Configuration Scope“ menu.

This menu will list, in a tree-like breakdown, all the websites, stores and store views you just created. If left on „Default Config“ any changes made to any of the configurations on the right will result in ALL the websites, stores, and store views to change. Also, at this point we do not need make any adjustment under any „Store“ or „Store Views“ from the scope menu. We’re not interested in that during this setup.

Select your main website here, in my case, or just „INFO website“.

This will refresh the page showing the configurations for that particular website only. Take note of the default settings. The address located under both Base URL’s is the actual web address of your main store. It should already be there for you. Don’t change anything here unless you already have your secure URL, then uncheck „Use Default“ and enter the Secure Base URL. Don’t forget your trailing slashes. Then save the settings for this page.

Under the „Scope“ menu select a „website“ matching one of your other addon domains, .BIZ in my case. This will refresh the page showing the configurations for that particular website.

Here, and for each additional domain store created, we will uncheck ALL the „Use Default“ boxes located in the „Unsecure“ and „Secure“ areas. For all the „Base URL“ and „Base Link URL“ fields, enter the HTTP web address for the website (domain store) in question as selected under the „scope“ menu, followed by a trailing slash. In this example we’re setting-up my .BIZ site, one of my addon domain stores. If you have your secure web address already for the website/domain, enter it under the Secure „Base URL“ field. I don’t have mine at this time, so I will enter it later. Under all the „other“ URL fields (for Skin, Media and JS), enter the HTTP address for the main website, the .INFO site in this case (see below). All the other URL fields need to point to the main website to get the appropriate data needed to display all the various pages for each domain store and for everything to function correctly. This is why you only need one magento installation.

Repeat this for each added Website under the scope menu, which I have already done for .NET and .ORG sites.

Steps 11-12

From „cPanel > File Manager“ or any FTP program, go to the folder for your main website and copy the „.htaccess“ and the „index.php“ files to each additional Addon Domain.

Here’s my example, in this case the .INFO domain is my main domain, so I will copy those two files from there to all the other domain root folders.

Next, open the „index.php“ file from each addon domain, in my case the „index.php“ file for .BIZ, .NET and .ORG.

I’m not going to change the main store’s index.php file (.INFO) at this time, but I will in a bit.

Then within each locate the following code …

$mageFilename = MAGENTO_ROOT . ‚/app/Mage.php‘;

Replace with the following code, include the complete ROOT address from your hosting account to your main store’s Mage.php file, .INFO in this case.

Note: I have included the original code for safe keeping should you need it (see below) …


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


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

Here’s my example …

Also, from within each addon „Index.php“ file, locate the following code at the end of the file …

/ Store or website code /

$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';


/ Run store or run website /

$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'Store';


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

Replace the MISSING data (between the empty quote, see below) with the „Code“ for each Website created earlier.

In the next active line, replace ‚Store‚ with the word ‚Website‚, make sure you keep the surrounding single quote marks.

Here’s my example …

Finally, open the „index.php“ file for the main website, in my case the .INFO domain, and locate the following code …

/ Store or website code /

$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';


/ Run store or run website /

$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';


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


Replace it with the following code …



/ Store or website code /

/ $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ''; /

/ Run store or run website /

/ $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store'; /

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



switch($_SERVER['HTTP_HOST']) {


/ 2nd Website /

case 'URL_ADDRESS#2':

case 'URL_ADDRESS#2':

Mage::run('URL_ADDRESS#2', 'website');



/ 3rd Website /

case 'URL_ADDRESS#3':

case 'URL_ADDRESS#3':

Mage::run('URL_ADDRESS#3', 'website');



/ 4th Website /

case 'URL_ADDRESS#4':

case 'URL_ADDRESS#4':

Mage::run('URL_ADDRESS#4', 'website');



/ main website /





Update the above „URL_ADDRESSES“ as appropriate for each Website created earlier when we were under Manage Stores, change nothing else.

If you only have one additional addon store then delete the code appropriately, here I have three extra stores, .BIZ, .NET, and .ORG. Or if you have more than three extras then simply add the extra code ended for each additional store. Don’t change anything for the section of the code for „Main Webite“.

Here is my example …

Do NOT make any changes at all to the copied „.htaccess“ files for each addon domain (extra stores).

However, open the „.htaccess“ file for the main website, in my case the .INFO domain, then add the following code to the end of the file …



## Multiple Store Settings, one section for each extra store


SetEnvIf Host www\.My Domain 2\.net MAGE_RUN_CODE=####

SetEnvIf Host www\.My Domain 2\.net MAGE_RUN_TYPE=website

SetEnvIf Host ^My Domain 2\.net MAGE_RUN_CODE=####

SetEnvIf Host ^My Domain 2\.net MAGE_RUN_TYPE=website


SetEnvIf Host www\.My Domain 3\.org MAGE_RUN_CODE=####

SetEnvIf Host www\.My Domain 3\.org MAGE_RUN_TYPE=website

SetEnvIf Host ^My Domain 3\.org MAGE_RUN_CODE=####

SetEnvIf Host ^My Domain 3\.org MAGE_RUN_TYPE=website


SetEnvIf Host www\.My Domain 4\.biz MAGE_RUN_CODE=####

SetEnvIf Host www\.My Domain 4\.biz MAGE_RUN_TYPE=website

SetEnvIf Host ^My Domain 4\.biz MAGE_RUN_CODE=####

SetEnvIf Host ^My Domain 4\.biz MAGE_RUN_TYPE=website



Replace each of the numbered „My Domain“ statements with the rest of the address appropriate for each domain Website. As before I have three extra stores, add or remove code accordingly. Make sure to leave all dots „.“ and carrots „^“ and slashes „\“ in place, and leave the word „website“ as the RUN_TYPE.

Replace each of the „####“ with the appropriate „Code“ for each addon Website we created earlier when we were under „Manage Stores“.

Here’s my example …

All done … your multiple stores should now be working. From this point simply adjust the Store View’s for each Website/Store, then add some products and your up and running.

Good Luck!

Ähnliche Einträge