cancel
Showing results for 
Search instead for 
Did you mean: 

Store view switch in front end does not work after setting up different domain for each store view

Store view switch in front end does not work after setting up different domain for each store view

When switching store view in the Magento front end, Magento responds only by redirecting back to the main store view on maindomain.tld
The site worked ok until I configured a different domain.tld for each store view in the Magento 2.3.2 admin panel. After configuring different domains for each store view, Magento was recompiled, deleted all cache and I hard reloaded the site in my browser to avoid local cache issues.
Also, when typing in domainstoreview2.tld, Magento redirects to domainstoreview1.tld.
Remarkable, when you generate a site map, store views keeps using the maindomain.tld for several store views. For sure these store views all have their own domain.tld in the base url settings.
After putting this within the .htaccess, the store view works when you type in storeviewdomain.tld, you have the right store view content:
SetEnvIf Host ^(.*)storeviewdomain1\.eu MAGE_RUN_CODE=en_GB
SetEnvIf Host ^(.*)storeviewdomain1\.eu MAGE_RUN_TYPE=store
SetEnvIf Host ^(.*)storeviewdomain2\.de MAGE_RUN_CODE=de_DE
SetEnvIf Host ^(.*)storeviewdomain2\.de MAGE_RUN_TYPE=store

However the store view switcher in the front end still does not work, when the browsers is in storeviewdomain2.tld and switch the scope to storeviewdomain1.tld, Magento redirects to the home of storeviewdomain2.tld.
The index.php file is original. What should I change to fix this?
1 REPLY 1

Re: Store view switch in front end does not work after setting up different domain for each store vi

In addition: the site is running on CentOS7 running nginx server and varnish cache. I don't have a nginx specific config for multiple domains. Do I need to change the niginx setup?