Magento Multi-Store with Different Themes & Domains Hosted on Plesk Server

There are countless tutorials around the web for setting up a Magento multi-store. Many of them are incorrect, many of them are incomplete, many of them won’t work for every hosting set up.

Just like WordPress MU, Magento multi-store is far simpler if your hosting plan uses cPanel. Plesk does things somewhat differently and can be more fiddly but if you’re looking for a fully fledged multi-store environment in Magento where different stores can look differently and resolve to different domains entirely and your server is equipped with Parallels Plesk, then this is for you!

Please note: If you want a Magento multi-store environment but you aren’t using Plesk, then this tutorial isn’t going to be much use to you as what will work for you will differ slightly (but feel free to leave a comment and I’ll try and post another tutorial for your scenario too).

Configuring Magento

Step 1

So the first step, is to set up your stores in Magento as necessary. For the sake of this example, we already have a store set up (default) in Magento and we’re going to create two additional stores (store 2 and store 3) which are going to run on the domains store1.com and store2.com (imaginative I know).

Navigate to System > Manage Stores and you will be presented with something similar to the below.

Magento Manage Stores

Step 2

The next step is to create your new website name, store name and store view name. These can essentially be anything you like as long they are clearly labelled so you know which store each represents in your Magento store view selector.

When you have set these up, you will have something like the below.

Magento Store Set Up

You will have noticed that when creating the stores, you will have a ‘Root Category’ option, if you just selected the only option there (likely labelled ‘Root Catalog’), then this means that each store will share the same category structure of products (you will still be able to customise each product per store) but if you want a completely different category structure for different stores, then you will need to go to Catalog > Manage Categories and create a new root category. Then you can go back into the store within ‘Manage Stores’ and change the root category for each store as you want it.

Step 3

Now that you have multiple stores set up within your Magento admin, you’ll be able to configure differently per store/store view, like next for example, we’ll need to specify the domains for each store.

Navigate to System > Configuration > GENERAL > Web and then select your second store from the ‘Current Configuration Scope’ like the below shows.

Magento Current Configuration Scope

Once you have selected your newly created second store, open up ‘Unsecure’ from the accordion shown above and in the base URL, you will insert the domain that ‘Store 2’ will use, in our example, this will be http://www.store2.com/ (always make sure you include the trailing slash here). You will also need to open up ‘Secure’ and set the ‘Base URL’ here too, if you will be serving content securely with an SSL certificate, then the only difference will be https instead of http otherwise it will be the same as the ‘Unsecure’ Base URL.

So at this point, you might have something similar to the below.

Magento Base URL Set Up

Step 4

You will need to specify which theme folders you wish to use for each store which again, like the above, navigate to System > Configuration > GENERAL > Design, select the store from the ‘Current configuration scope’ and open up ‘Package’ from the accordion like below.

Magento Setting the Package & Theme for Multi-store

You will need to enter the package name as the name of the folder as highlighted in the directory path below:-

/app/design/frontend/package/theme/...

For example:-

/app/design/frontend/store2/default/...

That’s pretty much all there is to the base Magento multi-store set up, then we head over to Plesk to continue the more complex part of the set up.

Configuring Plesk

Step 1

Log in to your Plesk panel and add your additional domains in the way you would usually so that the relevant folder and other Plesk set up is in place for them.

Repeat this for as many domains as necessary (hopefully you will have already pointed the nameservers for your domains to the same server where your Magento is installed, otherwise, do this).

Step 2

You will then need to set up the appropriate environment which in this case, as far as Plesk goes, you’ll have multiple domains set up but for the domains that will serve your additional stores in Magento, these will essentially map to the document root of your main store and already existing domain (thus sharing the same Magento installation).

And do to this, you will need to create what is known as a symbolic link (symlink).

First though, go back into the hosting settings for your newly created domains in Plesk and set the document root to /symlink instead of /httpdocs (can be named anything but at least you’ll know specifically what this directory is for with this name) for each like the below.

Plesk Setting the Document Root

 

Step 3

Next, you will need SSH access to your server which is terminal access over the Linux command line. Not all web hosts will provide this depending on your hosting plan but you will need to enquire with them as to whether they can provide this for you or complete these steps on your behalf.

In your terminal, you will want to browse the location of the new domains, so for store2:-

And you should see that the symlink directory was created in here (as per when you set it as the document root in Plesk). You will need to delete this directory though as it is not possible to create a symlink for a directory/file that already exists:-

Then you can create the symlink (replacing domain.com with the actual domain of your existing Magento site):-

Then you will need to set the correct ownership for the symlink (the second store and the username you would have chosen for the subscriber in step one of the Plesk configuration above) otherwise the second store will not be able to access anything in the existing Magento root:-

Step 4

Next, you will need to configure a directive in the PHP settings for the second store in Plesk, open_basedir. This allows the second store to open files outside of it’s own web space that Plesk created.

It is easiest to modify this from within the Plesk panel directly which you can do by navigating to the domain and opening up ‘PHP Settings’. Scroll down until you see the open_basedir directive like below:-

Modifying Plesk's open_basedir Directive

And just like the above, select ‘Enter custom value’ and insert with:-

Replace domain.com with the domain that your existing Magento installation sits in of course. Save your changes. Almost there now.

Finishing Up

Then we need to head back into the Magento and configure your Magento’s index.php to serve the correct store from Magento depending on which domain is being requested in the browser.

Open up index.php in your desired text editor from your Magento root and find umask(0); in the file.

Directly underneath, insert the following:-

You will want to use the website code you set for the relevant store in step two of configuring Magento above as the $_SERVER["MAGE_RUN_CODE"].

That should be it. If everything is implemented correctly, you should be able to load your additional domains in your browser like store2.com and see it load the theme that you have selected for this store in Magento as per step four of ‘Configuring Magento’ above.

Note: Repeat the above steps for each additional domain you are setting up to run a store on in Magento’s multi-store environment.

See how you get on following the above steps and if you run into any trouble, feel free to leave a comment below. Good luck!

Geoff Jackson

Geoff Jackson (more commonly known by his online pseudonym zigojacko) is the founder of Design Haven and The Clubnet Group which hosts numerous agencies including the most widely recognised of them, Clubnet Digital, a full service digital marketing and creative design/development agency. He also has a personal blog but it doesn't get updated as much as he'd like.

Sponsored Links...

Subscribe to Design Haven UK

Enter your email address to subscribe and receive our new posts by email.

28 Responses

  1. Mark says:

    I tried this but when I add your code to the index.php I get a white screen on both the main domain and the second domain.

  2. Hey Mark.

    Did you modify the domain name and store code in the index.php snippet to match your own?

    The white page is indicating an error (possibly syntax error), it should be logged if you want to check out your error log and see exactly what the issue was.

    • Mark says:

      I think the problem may have the line break at http://www.store
      $SERVER

      Things seem to be working now, thanks for the tutorial.

      • You may have only copied the visible section of the code Mark, there is more (below) that you have to scroll to see (or open the code in full screen).

        Glad you got it sorted though and found the post helpful 🙂

  3. Sammer says:

    I get an error when doing this:
    Forbidden
    You do not have permission to access this document.

    Any idea’s?

    • This is usually down to the permissions of the symlink Sammer.

      Refer to the last stage of step 3 in the Plesk configuration in the article and ensure that you are chowning the symlink to the same owner/group as your main domain ownership (instead of leaving it as the second domain ownership).

      Let me know if that helps.

  4. Brian says:

    Nice tutorial, followed it through easily. However I’m getting a 404 when I try to access anything in the new store. When I look at the symlink through putty and do a dir against it, it lists everything I’m expecting from the parent folder.

    My magento setup is within a magento folder so my symlink points to httpdocs/magento rather than just httpdocs. Through the browser if I type in the domain, it gives me the plesk Welcome to Parallels screen, surely it should be taking me to the magento index.php

    If I try the domain followed by /index.php – I get a screen saying ‘No input file specified’ it is like it has tried to get in through the symlink but failed, the access log file says it has a 404.

    I’ve set the PHP open_basedir to point to httpdocs/magento and set the owner/group to be the same as the main domain ownership

     

    • Hey Brian,

      The owner of the domain folder in vhosts for the second store needs to be the FTP user that you would have had to create in Plesk when adding the domain.

      For example:-

      If this doesn’t seem to help, please can you paste exactly what you have added to your open_basedir field in Plesk?

       

  5. Wojciech says:

    I followed your instructions but I am getting error: No input file specified. ??

    • It sounds like that’s a permissions issue Wojciech on your domain folder in vhosts.

      Please could you check that the permissions are as follows:-

      The above directories are CHMOD 0710 and each domain folder (recursively) have to be owned by the FTP user you created when adding the domains in Plesk.

  6. Ioan says:

    Hi,

    Thank you for this clear and simple to follow tutorial.

    When I try to access the second domain I get a white page with the following message: No input file specified.

    Any idea of how to solve this?

    • It sounds like that’s a permissions issue Ioan on your domain folder in vhosts.

      Please could you check that the permissions are as follows:-

      The above directories are CHMOD 0710 and each domain folder (recursively) have to be owned by the FTP user you created when adding the domains in Plesk.

  7. ikram says:

    Thanks for article,

    i got this error when try to access 2nd domain, i try several techniques but still not working… i follow steps very carefully
    Forbidden
    You do not have permission to access this document.

    Web Server at bargainblast.co.uk 

    • It sounds like that’s a permissions issue Ikram on your domain folder in vhosts.

      Please could you check that the permissions are as follows:-

      The above directories are CHMOD 0710 and each domain folder (recursively) have to be owned by the FTP user you created when adding the domains in Plesk.

  8. David says:

    I have also the message “No input file specified.” on domain2.

    I have check also permission :
    drwxx  5 ftpuser1 psaserv 4096 Mar 25 16:49 mainstore.co.uk
    drwxx  4 ftpuser2 psaserv 4096 Jun 24 13:40 secondstore.co.uk

    But I got still the issue.

    • Who hosts your website David? I don’t suppose it is GoDaddy by any chance?

      If so, please could you try the following…

      Open up the .htaccess file in the root of your mainstore.co.uk directory and uncomment (remove the preceding  #) the following lines:-

      Options -MultiViews

      Which you can find in the section labelled ‘GoDaddy specific options’.

  9. Lindsay says:

    HI,

    closest I’ve ever got to making it work on plesk, so thanks for the step by step.

    All I get now when I visit store2.com is store.com – the http://www.address changes, and I end up on the store.com website

    any suggestions as to where to look…

  10. adil says:

    ive used the symbolic link method, but the problem is that its not changing the theme for the other store, even though i have other themes installed. its like its not clearing the cache or something, it wont change the logo either from the magento backend or changing the meta info on the logo, any thoughts on what might be going wrong?

  11. F Miguel Gomes says:

    Hi Geoff

    Great article. Thanks you for putting it together.

    Are you available for hire?  Is this something you would be able to setup for us?

    We have had a Magento store for several years and now wish to add a new store/site.  Never done it before so we are quite afraid to break something. We would prefer to have an expert do it for us.

    Please kindly let us know.

    Thanks so much.
    F Miguel Gomes

    • Hey Miguel,

      Thanks for the great feedback and enquiry.

      Yes, we sure are available for hire (we are a full service digital agency), please feel free to give us a shout via our contact form.

      We’ve actually just implemented a multi-store environment for another client that came to us via this very article also.

      Thanks very much.

  12. Leslie says:

    Great article! I’m guessing these instructions are for Magento 1. Is the process similar for Magento 2? Thanks so much!

    • Hey Leslie, sorry for not replying sooner, I missed a load of comments in the system.

      I would suspect it would be the same process that works on Magento 2 also but I must admit, I haven’t actually tried myself yet so cannot be certain. Let us know how you get on.

  13. Steve says:

    Hi, I have follows your instructions down to the letter. However, like some others in the comments, I am getting a forbidden error, I am on my own dedicated server. I have changed all the permissions etc have set up the stores correctly and changed the index folder with the store2.com to my web doman.

    Please could you offer any advice?

    • Thanks for stopping by and leaving a comment Steve, sorry to hear of the issue your experiencing.

      In almost every case where this is happened, it is because the ownership of the httpdocs folder (and its contents) plus the symlink itself has not been changed to the web (FTP) user of the second domain.

      This has to be changed otherwise the additional domain(s) will not have the necessary permissions to view and read the main store located at the original domain’s document root.

  14. Steve says:

    Hi Mate – I did eventually get it working. What I had to do in plesk was:

    Go to domains>add domain> added “www.example.co.uk”. Then I went just underneath where you add the new domain name, to “Location of website files” and changed that from “create a new subscription” to  “example.com”, and this made example.co.uk have the same owner / subscription as the .com domain.

    I also uploaded and extracted the magento zip file directly through plesk, which gave everything the correct ownership and eliminated having to chown any folders to change ownership. After this, everything worked as it should, all except my theme. It works perfectly on the .com domain but the responisve part of it just will not work on the .co.uk domain. I have tried setting them up through the second store changing the {{secure & unsecure}} for skin, js and media – but still nothing.

    Oh and before I finish, I didn’t realise, that when setting up the second domain in plesk, I would have to wait well over 30 hours for it to go live.

    I am on a dedicated server, so I am not sure if the same steps need to be taken on a shared server using plesk.

    Thanks in advance for any advice you might be able to offer!

    Cheers

    Steve

Leave a Reply

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

%d bloggers like this: