How to create multiple websites in Magento 2?

Dec 12th, 2018 3 min to read

This article will help you to understand how one can add multiple websites in Magento 2.

Magento allows you to setup multi-websites on just single installation of Magento. Its configuration is really simple. It will allow you to create a separate website so you can handle the products, customers, product price and many more things on websites bases. 

After installing Magento you need to login into the store and follow the steps given below.

How to create multiple new websites in Magento?

You can create multiple new websites in Magento in 5 steps.

Step 1: Navigate to all store settings and click on create a new website

Navigate to Stores>Settings>All Stores and create a new website, a new store and a new store view. 

This is just the sample data. For instance, we have named our website a German website. After saving this information you will find it in the list as shown below.

Navigate to Stores>Configuration>General>Web>Base Urls, here you need to update the Base Url and Base link URL fields.

Navigate to Stores>Configuration>General>Web>Base Urls (Secure), here you will see that the Base Url and Base link URL fields will be automatically filled.

This image shows the base url section with the required domain name.

Step 3: Configure the store view and select the preferred store view

We need to update these URLs for the german website. You will see a store view option at the top of the page on the left side. Open this drop-down menu and select the german website.

Step 4: Save the configuration

Save this configuration.

Step 5: Open the .htaccess file and add the code

Now we need to open the .htaccess file from our Magento root directory. And find IfModule mod_rewrite.c section. Add below lines of code in this section.

SetEnvIf Host magentogerman.com* MAGE_RUN_CODE=german_website
SetEnvIf Host magentogerman.com* MAGE_RUN_TYPE=website

Now we will be able to access both our websites.

Speak your Mind

Post a Comment

Got a question? Have a feedback? Please feel free to leave your ideas, opinions, and questions in the comments section of our post! ❤️

* This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Thank you for your feedback

Comments (1)

  1. I have one question. Both domains point to the root folder?

    Reply

Grow your online business like 4,385 subscribers

    * This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
    envelope

    Thank You!

    We are reviewing your submission, and will be in touch shortly.