ECommerce Insights Blog

Stay on top of it all and get ahead with useful articles, how-tos, tips and tricks on e-commerce.

Magento Setup Multi Site, Multi Domain On Windows Home Server

There are many ways for Magento setup, configure multiple stores where every Magento store uses same code base and backend, the method you use depends on your own setup requirements. An interesting read could be how to setup & manage multiple stores in Magento. We have noticed many developers face issues installing, configuring Magento on local machine (server) especially on windows environment. Just to help everyone out we are writing this post to help setup multi site, multi domain Magento on windows server.

Magento Multi Site, Multi Domain Setup on Windows

For this particular requirement, we are going to take Windows 7 server installed on local machine. This is where we will deploy Magento setup to test before we migrate to production server. We will use Magento installed already on the local machine (read Magento installation guide for installing Magento). Now the different approach we are following is between using .com and .mage For local installation we will go with mystore1.mage and mystore2.mage and NOT While pushing this to production, you can easily change .mage to .com.

Website & Category Creation

For our setup we are using 2 virtual sites located under D:\vhosts\mystore1.mage and D:\vhosts\mystore2.mage

Since, mystore1.mage is already installed (default with Magento setup), so next task for us is to install the second domain which is mystore2.mage. To setup our second domain we need to follow the steps given below:

  1. Login to the Magento administrator panel.
  2. Go to the catalog tab and select Category Management
  3. Click the button Add Root category on the left.
  4. To the right, to name, I wrote 2 root category. Drop-down list is set to Yes for both is Active and Anchor.
  5. Click the Add Category button.
  6. Go to the System tab and select Manage Stores
  7. Click the button Create Website
  8. To name, we will write, and the Code, we will write mystore2_com. We will use this value later so please keep this in mind.
  9. Click the button Add website
  10. Click the button Create Store
  11. On the website, select from the drop-down list. To name, I wrote mystore2. For the root category, and selected 2 root category from the drop-down list.
  12. Click the button Save the store
  13. Click the button Create Store View
  14. In store, select mystore2 from the drop-down list and make sure it’s for website. To name, write Spanish (in case you have plans to add another language later). To get the code, we will write mystore2_es. for the state, select Enabled from the drop-down list.
  15. Click the button Save Store View
  16. Go to the System tab and select Settings
  17. For Current Configuration Scope (located in the upper left), change the drop-down default settings.
  18. Select Web from the sidebar on the left under the title GENERAL.
  19. Base URL for both, safe and unsafe, un-check Use Default [STORE VIEW] and enter the URL of your store, for example, http://mystore2.mage/. Do not forget the ending slash /
  20. Click the button Save Settings

After setting the second store, we have to set up store on the server side to access it from the browser.

Magento Setup Stores on Local Server

1. Now configure the Apache configuration file, httpd-vhosts.conf, for domains to set the DocumentRoot of our Magento directory. In our case, the directory is located here C:/server/apache/conf/extra/httpd-vhosts.conf (depending on which method you used to install your server and if you use the vhosts or httpd.conf).


DocumentRoot C:/vhosts/mystore1.mage mystore2.mage ServerName 

2. Edit .htaccess file in D:/vhosts/mystore1.mage/.htaccess mystore1 then add the following lines below:

# code to the main store 
SetEnvIf Host ^ mystore1.mage MAGE_RUN_CODE = base 
SetEnvIf Host ^ mystore1.mage MAGE_RUN_TYPE = website 
# Remember that this code comes from the configuration of the 
# second store established in point 8 
SetEnvIf Host ^ mystore2.mage MAGE_RUN_CODE = mystore2_com 
SetEnvIf Host ^ mystore2.mage MAGE_RUN_TYPE = website

3. Finally, restart the local Apache server for the changes to take effect.

All that remains now is to add products in the catalog and give each site a custom theme. Many people take advantage of the powerful functionality of Magento multi-store, whether to create multi-language stores, different catalogs and even the same catalogs with different interfaces as a marketing strategy.

We would love to know your own experiences of setting up multi-site, multi-domain on windows server. Please leave us a comment and let us know.