Multiple stores in one Magento install

Lately, we’ve been receiving a lot of questions on whether or not it would be possible to set up more than one webshop in a single Magento installation. Magento does indeed have this option, but the exact implementation may differ from case to case and from shop to shop. Another question we get a lot is “How do I set up an extra domain in Magento?”. To take away some of the mysteries and questions, we’ll give a brief explanation about how we have set up multiple Magento stores in one installation.

Extra domainnames in Magento

Every shop requires its own domain name. Say we sell exotic animals like camels (kamelen in Dutch) and we would like to open an online shop. First of all we would have registered the domain name with Byte’s Magento hosting services. We chose a package with some extra diskspace so the extra shops and products should fit nicely.
Because we want to sell these animals both in the Netherlands and abroad, we registered a second domain: We also have dromedaries for sale, so we registered a third domain:
At Byte, we get a Presence hosting package with these names, as these allow us to setup a Server Alias to connect these domains to the existing hosting space ( in our example).

Websites, stores, views…Stores en Websites

Before we continue, it is important to understand the difference between some common Magento terms: Websites, Stores and Store Views.

  • The difference between a Website and a Store, is that a websites only contains customer data but no products and categories.
  • Stores are the real shops. They contain all the products that the shop offers. Stores may have one or multiple Store Views.
  • Store Views are the different ways the Stores are being presented. For example, you could setup a different Store View per language.

Every Magento site will always have at least one Website, one Store and one Store View, all created in the Magento Admin interface (under System –> Manage Stores). In our case ( we set up the following:
We created one Website, called ‘Kamelen site’, with one Store, called ‘Kamelen shop’. We gave this Store two seperate Store Views: one in Dutch and one in English.
We also created a second Website called ‘Dromedaris site’, with one Store and only one Store View.
When creating Store Views, Magento asks for a code to use to reference these Store Views. We chose for ‘kamelen_nl’, ‘kamelen_en’ and ‘dromedaris’. These codes are important as we will need them later on to connect them to the domain names.

Magento Multistore Settings
Magento Multistore Setting


Connecting Domain names to Store Views

One of the first things Magento does when it loads is start up the Store View. Normally it starts the default Store View, but obviously you can change this, i.e. based on the domain the user is visiting to get to the website. The only thing we have to do is determine what Store view is being visited and start Magento with the code of that store front.
It’s not yet possible to connect domainnames with Store Views through the Magento backend, but luckily, this is a very simple procedure as you only need to change one file. Which file that is, depends on the version of Magento you use.

Connecting domains in Magento 1.3

In Magento 1.3 you can connect the domain name and Store View through the index.php file. This file loads all Magento files and subsequently starts the Website. Look for the following line in PHP:

Replace this line with the following:

Connecting domains in Magento 1.4

One of the differences between Magento versions 1.3 and 1.4 is that the code for detecting specific store fronts was removed from the default Magento files. This prevents all Store Views ending up at the same Website, or worse, a total breakdown of Magento, after upgrading the webshop.

Extra patch for Byte Hosting

At Byte Internet we use the ‘suExec’ principle for our webhosting, however the usual way to choose a Store View in Magento isn’t 100% compatible with this extra secured Magento setup. ‘suExec’ keeps your site extra secure, as it prevents unauthorized users from accessing your files. It also cleans up the environment variables to prevent your site from behaving differently due to them. Unfortunately Magento uses these environment variables to determine which Store should be loaded.
In order to make use of the variables stored in the environment you need to make a small adjustment to the index.php file. Around line 75 you’ll find the following line:

Replace this with:

Once you’ve made this change, Magento will know to also check the cleaned up environment variables to determine what Store View to load.

In Magento 1.4, the logic to determine the right shop is in the .htaccess file. This file sets up the environment variables that the index.php file will then consult to know what shop to load.

In the .htaccess file we added the following lines:

In this example there are 3 different Stores. All domains ending with ‘’ will lead to the ‘kamelen_nl’ Store. ‘’ will lead to the English Store and ‘’ is setup as well.

Configure different shops

Magento Config Scope
Magento Config Scop

The only thing left to do is setup the different stores in Magento. By default, the settings for all Stores are automatically the same as the Website settings and those in turn are linked to the global settings. You can change settings on al levels, and have them propagate downwards. You can change between levels by selecting the appropriate view, shop or global level in the drop down menu found in the Magento configuration editor in the top left.

The most important thing to change, is the base URL. You’ll find the setting in the Magento backend under System\Configuration\Web\Unsecure and \Secure. We’ve put the URL’s that Magento uses as the standard URL at all levels.

In our example under “Default Config” we’ve used “” as base URL as this is the main domain. The English version under “Kamelen Store” has” as it’s base URL “, and the ‘Dromedarissen’-version obviously has “” . If these shops have a HTTPS / Secure version as well, then you should also fill in the https-base-URL’s under “Secure”.


Magento baseURL settings
Magento baseURL settings


Obviously, creating different stores is just the beginning. There are still many options left in the Magento Admin Panel, but for now, we’ll leave it at this. If you have any tips or tricks for multiple Magento stores, feel free to let us know!