Multi Website Setup in Magento 2
Magento allows you to setup multi-websites for your single installed Magento. Its configuration is really simple which I’ll explain later. It will allow you to create a separate website and the real benefits are you can handle your products, customers, product price and may more things website wise. You can use these global or website wise depends on your needs.
You must have 2 different domains to setup multi-websites. like- www.magentotest1.com & test.magentotest1.com.
The first thing you need to do is log in to your Magento. Then follow the following steps-
1. Navigate to Stores>Settings>All Stores and create a new website than a new store and a new store view. you can use an already created store and store view the main thing you need to create is a new website.
2. Navigate to Stores>SettingsConfiguration>General>Web>Base URLs, here Base Url and Base link URL fields will be automatically filled.
Navigate to Stores>SettingsConfiguration>General>Web>Base URLs (Secure), here Base Url and Base link URL fields will be automatically filled.
3. Now you need to update these URLs for your newly created website. You’ll see a store view option on the top of the page on the left side. Open this drop-down and select your newly created website.
4. Now update the Base URL & Base Link URL fields in Base URLs and Base URLs (Secure). Save this configuration now.
5. Now you need to search for ‘$bootstrap=Bootstrap:: create (BP, $_SERVER);’ from your Magento pub/index.php file, add the following line, and save it.
1 |
|
6. Update local host file to add folder Linux
- Windows hosts
(C:\Windows\System32\drivers\etc)
編輯 hosts 文件
1 | echo "127.0.0.1 mysite.test" | sudo tee -a /etc/hosts |
or
1 | 127.0.0.1 magento2.docker |