Hi everybody, I am Cuong, Welcome back to my Magento 2 tutorial video series.
In the previous lesson, I showed everybody, How to create multilingual in Magento 2.
If you don’t learn this lesson yet, you can watch it here
Today, I am going to show everybody How to create multiple websites in Magento 2.
As far as we know, Magento allows us to create multiple websites using on same a backend but with difference frontends. You have multiple websites and you want to use it on same a backend, this tutorial will help you to do it working.
Before doing this practice, you need to make sure that, you have two domains pointing to same the path on your hosting.
In my localhost, I have two domains named
Both these websites pointing to same the path /var/www/html/magento/2.2.x/2.2.5
Let’s do this practice, you need to follow steps by step:
Step 1: Add a new Root Category
– Log into the backend and navigate to the Catalog → Catalog → Categories → Add Root Category
– Enter the Category Name
– Press the button Save.
Step 2: Create a new website
– Go to the Stores → Settings → All Stores → Create Website
– Enter the Web Site Information
– Press the button Save Web Site.
Step 3: Create a new Store for the second website
– Go to the Stores → Settings → All Stores → Create Store
– Enter the store information
– Press the button Save Store.
Step 4: Create Default Store View for the second website
– Go to the Stores → Settings → All Stores → Create Store View
– Enter the Store view information
– Press the button Save Store View.
Step 5: Setup the Base URL for the new website
– Go to the Stores → Settings → Configuration → General → Web
– On the top-left, in the box to view and manage the Store view, select the new website you just created. Go to the Base URLs and Base URLs (Secure) section.
– Modify to the new domain.
– Click the Save Config button.
Step 6: Set values for the MAGE_RUN_TYPE and MAGE_RUN_CODE
Open the index.php file under application root directory
Replacing this code: $bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);