I am trying to create multi websites in Magento 2 in local environment with XAMPP on Windows operating system 10.

I followed this tutorial : http://devdocs.magento.com/guides/v2.0/config-guide/multi-site/ms_apache.html.

Created multi websites in the admin, changed the base url of each website in the configuration (Stores->Configuration->Web) and specified the virtual hosts in the file C:\xampp2\apache\conf\extra\httpd-vhosts.conf like below attached screenshot Screenshot of Apache Virtual Host configuration file

Then specified the base URLs in the host file like follows: french.mysite.mg german.mysite.mg

I restarted the Apache server but none of the created websites are loading. Can you please correct me if I am missing anything?


The reason depends on result you receive trying open website on Store Front.

  1. Store Front opened with error (5xx, 404) - something with your apache configuration, maybe virtual hosts file is not being read. Check apache access and error logs, it can helps identify the problem.
  2. Store Front always redirect to base site (mysite.mg) - probably you forget to clean cache

I can't reproduce this case on latest develop branch.

It is important to know Magento version to be able check it as well.

|improve this answer|||||

Okay, i was stuck in your situation just like you, and after few time looking on Google, i've found the answer, only need to clear cache in your project, that's all.
For some one who looking to create virtual host in magento 2, i will put it here: In C:\xampp\apache\conf\extra\httpd-vhosts.conf put this:

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/magento"
    ServerName fudu.magento.net

In C:\Windows\System32\drivers\etc\hosts put this: fudu.magento.net

With fudu.magento.net is your virtual domain, and DocumentRoot "C:/xampp/htdocs/magento" is your project folder.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.