I deployed Magento 2.1 on console.google
Is there anybody who succeded to deploy multiple websites with different domains?
Magento2: How to create multiple storefronts
does not works for Magento 2.1
I am sure many people suffer the same issue?
There is not any answer to similar question for Magento 2.1 on link
How to setup another domain/website on the same Magento 2.1.0 installation? (updated)
Best Answer
You can create multiple websites or store views in Magento 2 admin panel and map unique domains to each of them.
Step 1: Point all domains to
pub
in Magento's root directoryStep 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.
Step 3: Set store or website for each domain as environment variable in
.htaccess
ofpub
directory or in the webserver configuration.Example with the websites as given in the question:
Example with store views instead of websites
These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace
abc\.com
with^abc\.com$
Step 4: Clear cache and access your domains.