Magento, a known name in the world of eCommerce where business relies on this platform to sell their products online. We all know, it is an open source platform catering numerous features and extensive support. From small to big, every business size depends on this platform to get everything that their store depends on.
There can be any number of stores a merchant is dealing with. Magento offers the freedom to configure as many stores you wanted by configuring one at the backend, however, it totally depends on your requirements which will decide the method of doing the same. One of the most important things to look for is to invest in a highly professional Magento Developer who would set up the things for you.
M-Connect Media has a group of Magento Certified professionals holding vast experience in developing thousands of Magento projects, thus setting up our client’s store targeting their business objectives. You can reach us anytime from here.
Having only one installation will be enough to setup multiple stores with different domains, different SSL certificates, and different is.
Let us start with the Magento Store setup steps:
Select Any URL Structure For Magento Store
Magento gives you the freedom to choose the structure of your store URL. This can be anything as you wanted.
Suppose, you have different stores running on the same domain:
Ex: store.com/clothes and store.com/footwear
Or, you have different stores running on different domains but have the same backend in Magento.
Ex: clothes.com and footwear.com
Similarly, you can set up your Magento store in any of its sub-domains.
Ex: clothes.store.com and footwear.store.com
Whatever URL you select for your store, the backend will be same for all stores and one codebase for all stores what we actually expected from this URL structure.
Add Another Magento Store
These are the steps to add another Magento store.
-
Locate the following path Catalog>>Manage Categories.
2.Now add a root directory by clicking on the Add Root Category button. Here add your store name and keep Is Active to yes.
3. From Display Settings tab, make the Is Anchor to Yes.
4.Navigate to System>>Manage Stores.
5.Here, add a website by clicking on Create Website button.
6.Now enter your website name and code. Here I have added store1.com as my store name and store as the code.
7.Click on Save Website button to save the website details.
8.Now create a store by clicking on Create Store button.
9.Select your website name from the Website drop-down list. Here, we have selected store1.com which we have created in above step. Now, enter your store name and select root category (your website name).
10.Click on Save Store button.
11.Now create a store view by clicking on Create Store View button
12.From here, select Main Store from your store dropdown. Here, I have selected Main Store option.
13.In the name field, enter English, enter the code as store1_en and Enable it from the Status dropdown.
14.Now, go to System>>Configuration.
15.Click on Save Store View button.
16.Now, select your website name from the top-left corner under the Current Configuration Scope drop-down. Here, I have selected store1.com.
17.Now, go to the Web section under the General tab in Configuration.
18.Now, for the Unsecure and Secure section, uncheck Use Default checkbox and enter the Base URL. Here I have added http://store1.com/.
19.Click on Save Config button to save the details.
Now, as you have added another new store to your website, now it’s time to select any one of the following methods so that Magento can locate your store. Here, I have listed four methods depending on which URL structure you are using.
-
Parked Domain Method
-
Addon Domain Method
-
Sub-domain Method
-
Sub-directory Method
# Parked Domain Method
This is one of the easiest methods to setup multiple stores in Magento. Basically, you have to keep one store already setup and add another store.
Follow below steps to create a new store on a Parked Domain:
-
Begin with by login to cPanel for your domain.
-
Now, click on Parked Domains icon.
-
Here, you have to enter the domain name that you are going to use while setting up a second store. I will enter here store1.com.
-
Click on the Add Domain button.
-
Open the index.php file for Magento.
Mage::run($mageRunCode, $mageRunType);
6.Now, replace the last line of the code with the following code.
switch($_SERVER['HTTP_HOST']) {
case 'store1.com':
case 'www.store1.com':
Mage::run('store1', 'website');
break;
default:
Mage::run($mageRunCode, $mageRunType);
break;
}
If you have more than one store, then you will need to add additional cases in this code as below:
switch($_SERVER['HTTP_HOST'])
{
// store1.com
case 'store1.com':
case 'www.store1.com':
Mage::run('store1', 'website');
break;
// store2.com
case 'store2.com':
case 'www. store2.com':
Mage::run('store2', 'website');
break;
// Mainstore.com (default store)
default:
Mage::run($mageRunCode, $mageRunType);
break;
}
#Addon Domain Method
This method is applicable when you need to setup multiple stores where each store has their own domain name. To use this method, make sure to have your domain administrative account handy to modify it later.
Follow the steps below:
-
Login to your cPanel for your domain.
-
Click on the Addon Domains icon.
-
Now, here I will enter “store1.com” as my new domain name. Thereafter, cPanel will automatically fill the next two fields, therefore you need to remove the public_html/ from the Document root field.
-
Define a new password for this domain name.
-
Now, click on Add Domain button.
-
Use SSH to log in to your website. Locate the directory which we have already set in the Document Root field in the previous step while adding the domain. Perform the following steps:
cd store1.com/ 7.Go to the Magento installed directory and copy index.php and .htaccess files. cp ../public_html/index.php ../public_html/.htaccess 8.After copying the index.php file, open it and replace the following code: $mageFilename = 'app/Mage.php'; with $mageFilename = '../public_html/app/Mage.php'; 9.Secondly, replace the following code from the index.php file itself: Mage::run($mageRunCode, $mageRunType); with
Mage::run('mystore2', 'website');
10.At last, you need to create the symbolic links to point to few directories as shown below:
ln -s ../public_html/404/ ./404 ln -s ../public_html/app/ ./app ln -s ../public_html/includes/ ./includes ln -s ../public_html/js/ ./js ln -s ../public_html/media/ ./media ln -s ../public_html/report/ ./report ln -s ../public_html/skin/ ./skin ln -s ../public_html/var/ ./var This Method is applicable when you want to setup multiple stores under different subdirectories on the same server. In this method, there is one primary domain and you will call your additional store by calling the subdirectory in the URL.
Mainstore.com/store1
Maninstore.com/store2
Follow the below steps:
-
Log in to your website using the SSH.
-
Create a subdirectory where your second store will be located.
cd public_html
mkdir store1/
cd store1/
3. Go to the Magento installed directory and copy index.php and .htaccess files.
cp ../public_html/index.php ../public_html/.htaccess
4. After copying the index.php file, open it and replace the following code:
$mageFilename = ‘app/Mage.php’;
with
$mageFilename = ‘../public_html/app/Mage.php’;
5. Secondly, replace the following code:
Mage::run($mageRunCode, $mageRunType);
with
Mage::run(‘store1’, ‘website’);
#Sub-Domain Method
This method is applicable when you want to setup your additional store in a sub-domain. To use this method, you should first have a primary domain where your Magento store is already running.
According to this method, your store will look like store1.mysite.com.
1. Login to your cPanel for your domain
2. Click on the Subdomains icon.
3. Now, here I will enter store1 for subdomain. The cPanel will automatically fill the next field, therefore, remove the public_html/ from the Document Root field.
4. Click on the Create button.
5. Login to your website using the SSH and locate the directory that we have previously set in the above steps for the Document Root Field. I will do the following:
cd store1/
6. Go to the Magento installed directory and copy index.php and .htaccess files as following:
cp ../public_html/index.php ../public_html/.htaccess
7. After copying the index.php file, open it and replace the following code:
$mageFilename = ‘app/Mage.php’;
with
$mageFilename = ‘../public_html/app/Mage.php’;
8. Secondly, replace the following code in the index.php file.
Mage::run($mageRunCode, $mageRunType);
with
Mage::run(‘store1’, ‘website’);
How to Manage Multiple Stores
Once, you have done setting up multiple stores, then it is important to change the configuration of your Magento store.
To configure identical settings for each store, change the default Current Configuration Scope and uncheck the Default Config checkbox and input your change.
If you face any difficulty in setting your store, then contact our Magento Support .
Thanks for telling us about the creating multiple stores with Magento. I am unsure about coding part, but the rest of the piece is great! Keep it up.
Nice useful article! I am planning to expand my business in next few months. The steps which you have shared for creating multiple stores for Magento platform is quite important for me at this stage. I also understood the methods which you mentioned. Thanks for helping me out at this critical time.