Tuesday 18 November 2014

How to set multiple stores/websites with one magento installation on different domains

This article will describe quickest way how to use and configure one Magento installation on different domains.
Point here is what do you want to have on that different domains, for example you want to have chosen categories/products on one domain and the other one will be on different language.
First you figure that and then go to configuration.

So for each domain you need to create webiste in main Magento admin installation:
System > Manage Stores > Create Website
For Name: you enter name of you desired domain (“my.website.com”)
For Code: you will enter identifier for that domain (“my_website_com”)
After that you will go to:
System > Manage Stores > Create Store
For Website: you will select “my.website.com” from dropdown menu.
For Name: I like to enter same as website (“my.website.com”) so I know for which website this store is but you can put here whatever you want.
Now for the Root Category: if you whish to have different menu for that website you will need to create new root category under
Catalog > Manage Categories > Add Root Category
in which you will put categories for that website.
And in the end you need to setup Store View under:
System > Manage Stores > Create Store View
Under Store: select “my.website.com” from dropdown menu.
For Name and Code enter “my_website_com”
And for Status: “Enabled”
If you wish to have diiferent language on that wesite you will need to change that on
System > Configuration
Under Current Configuration Scope: select your website/store from dropdown (“my.website.com”)
Under General tab go to
Locale Options and for
Locale choose language from dropdown (don’t forget to install language pack).
To run Magento on your different domain you need only two files:
.htacces
index.php
Open “index.php” and modify line which begins with “$mageFilename”
so it goes something like this:
$mageFilename = 'path_to_your_real_magento_installation_dir/app/Mage.php';
and line:
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
replace with:
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : 'my_website_com';
Now you will also need media, skin and javascript files so you can also copy them into root folder of your new domain or you can set it from Magento admin:
Under Current Configuration Scope: select your website/store from dropdown (“my.website.com”)
Go to Web tab and under Secure and Unsecure you need to modify:
Base Skin URL (example: http://real.website.com/skin/)
Base Media URL (example: http://real.website.com/media/)
Base JavaScript URL (example: http://real.website.com/js/)
That’s it.
Enjoy coding!



No comments:

Post a Comment