cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.2 Multistore with different domains not working

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Re: Magento 2.2 Multistore with different domains not working

Does anybody have a solution for this. I tried all available options but I seem to be stuck at the same as gerwin_janssen

Re: Magento 2.2 Multistore with different domains not working

you have to edit your virtual host for the second domain to point at the main magento home directory....having said that i cant get it working yet on Magento 2

Re: Magento 2.2 Multistore with different domains not working

Thanx its works great for multi website

Re: Magento 2.2 Multistore with different domains not working

Thanx Its working for magento 2. kudos to you

Re: Magento 2.2 Multistore with different domains not working

@Rajesh_Gohil Which solution is working well for multiwebsites with different domains?

Re: Magento 2.2 Multistore with different domains not working

I have created below sites: [PS: For security reason, i have not disclosed our actual domain name]
  1. Our Corporate Website Store
  1. Site created for one of our clients i.e. ABC
 
Now, we want to point the store created for ABC to https://abc.ourdomain.co.in
 
I have added below lines in .htaccess file in public_html/pub folder.
############################################
## Enable rewrites
    Options +FollowSymLinks
    RewriteEngine on
    SetEnvIf Host www\.magento2.ourdomain\.co.in MAGE_RUN_CODE=base
    SetEnvIf Host www\.magento2.ourdomain\.co.in MAGE_RUN_TYPE=website
    SetEnvIf Host ^magento2.ourdomain\.co.in MAGE_RUN_CODE=base
    SetEnvIf Host ^magento2.ourdomain\.co.in MAGE_RUN_TYPE=website
 
    SetEnvIf Host www\.abc.ourdomain\.co.in MAGE_RUN_CODE=abc
    SetEnvIf Host www\.abc.ourdomain\.co.in MAGE_RUN_TYPE=website
    SetEnvIf Host ^abc.ourdomain\.co.in MAGE_RUN_CODE=abc
    SetEnvIf Host ^abc.ourdomain\.co.in MAGE_RUN_TYPE=website
################################################
 
I have also added below lines in .htaccess file in (root folder of magento) i.e. public_html folder
##########################################
SetEnvIf Host abc.ourdomain.co.in* MAGE_RUN_CODE=abc
SetEnvIf Host abc.ourdomain.co.in* MAGE_RUN_TYPE=website
##########################################
 
On our cloud server we are using Centos 7.9.2009. I have added required host entries in extra.conf file in following folders:
/usr/local/apache/conf/userdata/std/2_4/abc/abc.ourdomain.co.in
/usr/local/apache/conf/userdata/ssl/2_4/abc/abc.ourdomain.co.in
 
The content of extra.conf is as below:
 
  ServerName abc.ourdomain.co.in
  DocumentRoot /home/m2user/public_html/pub/
  ServerAdmin my@email.id
  UseCanonicalName Off
 
  ## User abc # Needed for Cpanel::ApacheConf
  UserDir enabled m2user
 
  # Enable backwards compatible Server Side Include expression parser for Apache versions >= 2.4.
  # To selectively use the newer Apache 2.4 expression parser, disable SSILegacyExprParser in
  # the user's .htaccess file.  For more information, please read:
  <IfModule mod_include.c>
    <Directory "/home/m2user/public_html/pub/">
      SSILegacyExprParser On
    </Directory>
  </IfModule>
 
  <IfModule mod_suphp.c>
    suPHP_UserGroup m2user m2user
  </IfModule>
 ................
 ................
 
To customize the VirtualHost I have added below lines in httpd.conf file of Apache2
for Port 80
  # To customize this VirtualHost use an include file at the following location
 Include "/etc/apache2/conf.d/userdata/std/2_4/abc/abc.ourdomain.co.in/*.conf"
 
and Port 443
  # To customize this VirtualHost use an include file at the following location
 
Include "/etc/apache2/conf.d/userdata/ssl/2_4/abc/abc.ourdomain.co.in/*.conf"
 
In Magento 2 admin panel, required configuration is also done.
After restarting apache service, on visiting https://abc.ourdomain.co.in link website is not opening and showing "File Not Found" error.
 
I think I have followed all required steps to configure the multi store websites. But not sure where and what is going wrong?
 
Please guide me to get this resolved.