Hide Articles
 •   March 29, 2016  •   Setup

Magento Multi-Store on a Plesk Server

Hide Articles

One of the very useful and convenient features of Magento is the ability to create a multi-store setup. Multi-store setup is simply a way of being able to setup a second domain using the same installation as that of the first domain and yet share your product catalog and code.

For example, let’s say we have a domain “www.clothing.com” . You have installed Magento for this domain and also setup the store, storefront and updates for all your product catalogs. All well and good here.

Now, your domain being an online store for a wide variety of clothing, you probably will want to reduce the clutter and provide your customers an option for a smoother experience going through your products. Let’s say, you want to do this by creating sections in the store as Clothing for Men and Clothing for Women while still retaining the original domain and store. Let’s call these domains “www.clothingformen.com” & “www.clothingforwomen.com”

Ideally, you will need to build a new website, a store and product catalog for each of them from scratch within their own independent Magento installation. Just like it sounds, it’s quiet tedious and this is where the usability of a multi-store setup comes in. Using a multi-store you can simply use the same installation, store and product catalog as that of the main domain for the new domains.

This guide will help you through to setup the multi-store on a Plesk 12.5 server along with Magento 1.9.2.2-40.

Assuming you already have setup the main domain along with its store (store 1) we need to set up the new domains along with its stores now.

Step 1 : Log in to the Magento Administrative interface and go to System > Manage Stores

Step 2 : Now, we need to add your new website name, store name and store view name. While creating the stores, you have an option to select the ‘Root Category’ option which will use the same category structure as the main domain. Or else you can create a new category by going to Catalog > Manage Categories and create a new root category.

Step 3 : Now, we need to assign the new domains for each store. Go to System > Configuration > GENERAL > Web and then select your second store from the ‘Current Configuration Scope’ of the left hand side drop down box.

Select the newly created domain, open “Unsecure” from the right hand side and in the “Base URL” field, enter the new domain name, for eg: www.clothingformen.com/. Repeat the same for the “Secure” section too.

Step 4 : By going to System > Configuration > GENERAL > Design, select the store from the ‘Current configuration scope’ and open up ‘Package’, you can set the theme for the domain from here.

Now, you need to login into your Plesk panel and simply create the second domain as an Alias for the main domain, in this case that would be “www.clothingformen.com” as an Alias for “www.clothing.com”

Once that is done, open up the “index.php” file and edit the following section as follows:

umask(0);if ($_SERVER['HTTP_HOST'] == "newdomain.com" || $_SERVER['HTTP_HOST'] == "www.newdomain.com"){
$_SERVER["MAGE_RUN_CODE"] = "website_code";
$_SERVER["MAGE_RUN_TYPE"] = "website";
}
/* 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);

You will need to replace the “store” with the store name we had given earlier. Repeat the same for the third domain that is “www.clothingforwomen.com”. Now, you will be able to manage all the 3 domains from the same control panel and share the same stores.

About the Author:

Sensible, stylish, jovial and unintimidating, Ranjith is equally proficient at Windows and Linux system administration. Apart from being a tech, he is a motorbike fanatic, blogger and WWE enthusiast who exuberates confidence, enjoys challenges and takes risks.

Tags: Magento | Multi-Store | Plesk

  1. This is the most succinct summary of this process I have seen. Question and clarification.

    1) Will this process result and enable separate, store designs to be displayed? For example mensclotingstore.com with one ‘skin’ and womensclothingstore.com with a different design / skin?

    2) Can you provide further detail on the process in Plesk?
    – I think the process is thus: a) in the account – select add domain b) select the main domain for the site as the shared account c) set the root directory to the same directory as the main domain. For example if domain A is /httpdocs then you should set domain B to /httpdocs

    You can then enable SSL per domain and per site. Correct?

    • Ranjith Muraleedharan on said:

      @John Hamlin

      Yes, it is possible to maintain different themes for each of the stores. This can be done as you do normally from the “System >> Configuration >> Design” page by selecting the appropriate store.

      As far as Plesk is concerned, you just need to simply create the second domain as an Alias for the main domain. Once that is done, open up the “index.php” file of the main domain and edit the section as explained in the article.

      What happens here is, when you call any of the domain (Main or secondary), the index.php file redirected the visitor to the correct store.

      Regards,

Leave a Reply

Your email address will not be published. Required fields are marked *

*