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?


5 Answers 5


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.


Created multi website in magento, Steps to create a multistore in admin panel is same as like in magento1.x. Don't forget to change the base url and secure url for new website/store. Once made changes in admin panel follow the below steps,

1) Create a new folder in magento root and copy the index.php and .htaccess files from magento root to new folder.

2) Edit the index.php which is in new folder


$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);

/** @var \Magento\Framework\App\Http $app */

$app = $bootstrap->createApplication('Magento\Framework\App\Http');



 $params = $_SERVER;

 $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website2'; //Webite code as same in admin panel

 $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';

 $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

 /** @var \Magento\Framework\App\Http $app */

 $app = $bootstrap->createApplication('Magento\Framework\App\Http');


And also update bootstrap.php include path as below,


require __DIR__ . '/app/bootstrap.php';


require __DIR__ . '/../app/bootstrap.php';

3) Create a simlinks inside the new folder

 ln -s /home/example/example.com/html/app/ app 

 ln -s /home/example/example.com/html/lib/ lib 

 ln -s /home/example/example.com/html/pub/ pub 

 ln -s /home/example/example.com/html/var/ var 

Refer this

Please clear the var/generation,var/cache and pub/static files and do the static content deployment.


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.


There are 6 steps to implement multiple website or store on the Magento2 site.

Step 1: Create a Root Category

Step 2: Create a new website

Step 3: Create a new store

Step 4: Create store views

Step 5: Configure the Store URL

Step 6: Map the vhost to work with Magento 2

  • can you make a video about multiwebsite virtul host setup? Feb 14 at 12:43

if you are using nginx server you need to follow below steps Add This Entray on below files

sudo nano /etc/nginx/fastcgi_params

 # Magento Variables
 fastcgi_param  MAGE_RUN_TYPE      $MAGE_RUN_TYPE;
 fastcgi_param  MAGE_RUN_CODE      $MAGE_RUN_CODE;
 fastcgi_param  MAGE_MODE          $MAGE_MODE;



server {
  listen 80;
  listen 443 ssl;
  include snippets/ssl-cert.conf;
  server_name local.magento245.com;
  client_max_body_size 32M;
  set $MAGE_ROOT /var/www/html/magento2/magento245;
  set $MAGE_RUN_TYPE website;
  set $MAGE_RUN_CODE fr;
  set $MAGE_MODE developer;
  #set $MAGE_MODE default;
  #set $MAGE_MODE production;
  fastcgi_read_timeout 3000;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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