Magento2 - multistore using different domains, relative folder in base url & store codes… language switcher broken
-
16-03-2021 - |
Question
This is a Magento 2.3.2 CE project
Let's assume url of default storeview is https://www.domain.com/store/es
Url of second storeview is https://www.domain.pt/pt
Language switcher gives error, redirecting to same storeview 404 page... is this a bug or a feature? I understand this url configuration is weird, and it makes no sense using store codes in this case
Solution
i have also faced the similar issue last month and this is how i had fixed it.
try the below method hope this will work for you also
I managed to fix the problem by adding following code in .htaccess
file:
SetEnvIf Host [domain1] MAGE_RUN_CODE=[website1 code]
SetEnvIf Host [domain1] MAGE_RUN_TYPE=website
SetEnvIf Host [domain2] MAGE_RUN_CODE=[website2 code]
SetEnvIf Host [domain2] MAGE_RUN_TYPE=website
let me know if this works for you
OTHER TIPS
Without knowing more details, I had a similar issue and it was a result of having
<referenceContainer name="content" display="false"/>
in the custom layout update section of any category/CMS page. The reason for this is that Magento stores two key template files in the content referenceContainer to keep customer/store data up to date.