Magento 2 Setup Multiple Websites

Follow the below steps to configure multiple magento websites

1) Create websites, stores, and store views in the Magento Admin

2) Create Apache virtual hosts.

Edit the file E:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
 ServerName phpcode.com
 DocumentRoot E:\xampp\htdocs\phpcode\pub
 </VirtualHost>

<VirtualHost *:80>
 ServerName in.phpcode.com
 DocumentRoot E:\xampp\htdocs\phpcode\pub
 SetEnv MAGE_RUN_CODE "india"
 SetEnv MAGE_RUN_TYPE "website"
 </VirtualHost>

3) Restart Apache.

4) Edit your vhost file(In my system its C:\Windows\System32\drivers\etc\hosts)

127.0.0.1 phpcode.com
127.0.0.1 in.phpcode.com

5) Verify the sites accessing the following URLs

phpcode.com
in.phpcode.com

Leave a Reply

Your email address will not be published. Required fields are marked *