3

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:

127.0.0.1 french.mysite.mg
127.0.0.1 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?

ProcessEight
1,0101 gold badge8 silver badges20 bronze badges
asked Jan 18, 2017 at 7:25
3
  • Have you found any solutions on how to setup multisite on xamp? Commented Jul 11, 2017 at 10:42
  • Did you edit your host file properly? Commented Oct 25, 2017 at 16:16
  • magento.stackexchange.com/questions/94855/… try this Commented Dec 29, 2017 at 7:02

5 Answers 5

0

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.

answered Jan 18, 2017 at 11:48
0

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

Replace:

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);

With:

 $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');
 $bootstrap->run($app);

And also update bootstrap.php include path as below,

Replace:

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

With:

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.

answered Dec 29, 2017 at 7:01
0

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
</VirtualHost>

In C:\Windows\System32\drivers\etc\hosts put this:

127.0.0.1 fudu.magento.net

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

answered Aug 22, 2018 at 1:54
0

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

Marius
199k55 gold badges431 silver badges837 bronze badges
answered Jul 5, 2021 at 10:51
1
  • can you make a video about multiwebsite virtul host setup? Commented Feb 14, 2024 at 12:43
0

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;

HostEntray

=====

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;
}
Murtuza Zabuawala
14.8k10 gold badges47 silver badges76 bronze badges
answered Jan 24, 2023 at 5:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.