This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

CloudwaysCDN — a powerful solution that offers superior performance and satisfied global audience for your business. Read More

How To Create & Configure Multi Store In Magento 2

Updated on  18th January

4 Min Read
Reading Time: 4 minutes

Magento is an incredibly powerful ecommerce software that is the most preferred amongst ecommerce store owners. Recently, Magento 2 was launched with new features. One of the features for developers and merchants is the Magento 2 multistore function.

Magento 2 Multistore

We can setup Magento 2 multistore like we did in Magento 1, however, as we know Magento 2 is totally different with Magento 1 and is a bit difficult to get along for those peoples who recently started development in Magento 2 because of the change in the file system.

In this article, I am going to show you how to configure Magento 2 multistore.

Cloudways Magento Hosting For Developers

Create Second Store:  

For creating Magento 2 second store, go to your Magento 2 admin dashboard and then go Stores/ Settings / All Stores

magento 2 admin panel

  • Under  “All Stores”  you can see three options “Create Website”, “Create Store View”, “Create Store”. First click on Create Website Button.

                  Create Store magento 2
  • In the name field, enter your second store name
  • In code field, enter your second store code name (Be sure to remember your second store code)second store magento 2
  • Now click on Create Store for your second store website and those you created before. Click on “Create Store” option.Create Store magento 2
  • In “Web Site” option select your Magento 2 website
  • In “Name” field enter your Magento 2 store view name
  • In “Root Category” select “Default Category” and click on the “Save Store” button.multi store magento 2
  • After creating store now create store view for your Magento 2 second store. Click on “Create Store View”Create Store View magento 2
  • In “Store” field select your Magento 2 store
  • In “Name” field enter your Store View Name
  • In “Code” field enter code those you enter in “Create Website”Create Store View Magento 2
  • After this, click on “Save Store View” button. And now we connect our second store domain with new store that we have just created. Go to Stores > Settings > Configurationmultistore magento 2
  • Under “Configuration” select your second store in “Store View” option, the one you see on topmagento store configuration

Your store is now set-up successfully at the back-end of Magento 2. Now set values for MAGE_RUN_TYPE and MAGE_RUN_CODE by using the following code in your index.php entry point:

Save your index.php file. After this set values in .htaccess file. This section discusses to set values for MAGE_RUN_TYPE and MAGE_RUN_CODE for using Apache Server Variables SetEnvIf or RewriteCond.

For setting up SetEnvIf, add following code in your .htaccess file after “RewriteEngine on” this:

SetEnvIf Host .*example.com.* MAGE_RUN_CODE=yourcode.yourdomain.com
SetEnvIf Host .*example.com.* MAGE_RUN_TYPE=website

For setting up RewriteCond, add following code in your .htaccess file after “RewriteBase /magento/” This:

Save your .htaccess file.

Your Magento 2 Multiple Store is now ready for deployment! You worked so hard to put it to work, why not host it on the most optimal performance oriented ecommerce hosting platform to ensure that your cart abandonment stays below the danger line. Come home to the best managed Magento hosting platform, Cloudways.

Share your opinion in the comment section. COMMENT NOW

Fayyaz Khattak

Fayyaz is a Magento Community Manager at Cloudways - A Managed Magento Hosting Platform. His objective is to learn & share about PHP & Magento Development in Community. Fayyaz is a food lover and enjoys driving. You can email him at m.fayyaz@cloudways.com

Start Growing with Cloudways Today.

Our Clients Love us because we never compromise on these

Get Our Newsletter
Be the first to get the latest updates and tutorials.

THERE’S MORE TO READ.