Creating a Magento multi-store using SNI

Time to Read: 15 minutes Difficulty Level: Intermediate
Tools Needed: Plesk control panel access, existing Magento 1 installation Last Updated: 06/12/2018


Magento is a web application designed so that other users or developers can add to its capabilities. One of its most popular features is the creation and management of multiple store fronts within a single Magento account. This is known as a Magento multi-store. This guide will demonstrate how to do this for a Magento 1 installation.

A new store would be known as the child store, and you would be linking it to a parent store, an existing Magento store you have, ensuring that the application is tightly integrated within your Plesk Panel.

You can do this by making using of SNI. SNI stands for Server Name Indication, allowing you to host multiple SSL certificates on a single IP address. Using SNI we are able to make use of domain aliases (imagine multiple doors to the same location) to simplify the multi-store application. Since SNI is now widely adopted, this is the best and recommended method of implementing a Magento 1 multi-store.

The scenario
Configure Magento
Create our child store
Configure the index.php of your parent store

The scenario

For the purposes of this example, we currently have an existing Magento store,, that sells t-shirts within the United Kingdom (NuBlue t-shirts are not yet available, sorry!). We are looking to expand our Magento store to sell t-shirts on an international scale, with plans to expand to the United States and then to parts of the EU should our first foray to foreign shores be successful.

Configure Magento

We first need to configure our existing Magento instance to integrate with our new child store. This can be done directly within your existing Magento Admin Panel.

Browse to System and Manage Stores. Click on Create Website, Create Store and Create Store View. As these are somewhat dependant on each other, once all three are created you can go back and link them to each other. E.g. you cannot select the T-Shirts US Store View (our new child store) as the Default Store View when creating your new store until the Store View has been created.

The following three screenshots should give you an idea on how to configure your new Website, Store and Store View correctly.

Our final step for configuring Magento for use with your new child store is to edit Magento’s two base URL variables. This is done within your Magento Admin Panel under System and Configuration. Browse to ‘Web and under Unsecure and Secure edit the current base URL, which should presently be set to your parent store, to that of your new child store. It is imperative that you leave the trailing slash in place, and that you should note the differences between unsecure (http://) and secure (https://) within your configuration. Once these changes have been made, clear your Magento cache.

Create our child store

As Magento should already be configured using the instructions above, we now need to configure our new child store domain within the Plesk Panel. This process involves adding an additional domain to an already existing subscription.

To add an additional domain to an existing subscription within your Plesk Panel, browse to Subscriptions, select the subscription associated with your existing previous, select Websites & Domains, scroll down and select Add New Domain.

Enter the domain of your child store within the ‘Domain name’ text box, and adjust ‘Document root’ from the default value to ‘httpdocs’ (which matches the current value of your parent store).

Configure the index.php of your parent store

The final step is to configure your Magento store to display the child store when triggered by an event, which will be when a user enters your domain name into the address bar. This can be done by editing the index.php (the ‘skeleton’ of a website) file associated with your Magento store for the parent domain. This can be done by using the text editor FTP, or within your Plesk Panel using the File Manager tool. We will make use of File Manager, which can be found within your subscription (for the parent domain) under ‘Websites & Domains’ and ‘File Manager’.

Within your index.php file you should append an adaptation of the following directly under umask(0); :

if  ($_SERVER['HTTP_HOST']  == ""  ||  $_SERVER['HTTP_HOST']  ==  ""){$_SERVER["MAGE_RUN_CODE"]  =  "website-code"; $_SERVER["MAGE_RUN_TYPE"]  =  "website"; }

That’s it! All that remains is for you to configure your new child store to meet your own requirements. A good place to start is usually choosing a different root category (remember, everything above the root category won’t be displayed on the site) with products applicable to your new store.