cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.2.2 Cloud EE Multisite in subdomain keep redirecting to main website domain

Magento 2.2.2 Cloud EE Multisite in subdomain keep redirecting to main website domain

Hi Magento Community,

 

We have setup Magento project in Magento cloud commerce with version 2.2.2. We created another website, store and store view in the same Magento instance to use the multi-website concept. 

 

We followed the article on this page: https://devdocs.magento.com/guides/v2.2/cloud/project/project-multi-sites.html

 

Now, when we try to browse the subdomain/second store, it's getting redirected to the main website store. 

 

When we try to debug, the echo die is not working in the index file.  

 

What could be the issue? Please guide.

4 REPLIES 4

Re: Magento 2.2.2 Cloud EE Multisite in subdomain keep redirecting to main website domain

@Gideon BabuConnect with the cloud support for the help. You may be missing an entry in an YAML file which can only be updated by Cloud support or Fastly need some adjustment. Cloud support can resolve it much quicker.

 

 

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

Re: Magento 2.2.2 Cloud EE Multisite in subdomain keep redirecting to main website domain

Thanks for your reply Tharandeep.

Re: Magento 2.2.2 Cloud EE Multisite in subdomain keep redirecting to main website domain

Have u made any changes on magento_vars.php file on root of cloud setup?
You need to add your code here.
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Magento 2.2.2 Cloud EE Multisite in subdomain keep redirecting to main website domain

Yes, I have added few lines of code in magento-vars file. 

 

if (isHttpHost("example.")) {
    $_SERVER["MAGE_RUN_CODE"] = "example";
    $_SERVER["MAGE_RUN_TYPE"] = "store";
}

I got it working now by changing the value from 

if (isHttpHost("example.domain.com")) {

 to 

if (isHttpHost("example.")) { // just the subdomain code and dot to represent the subdomain

// kept the return as it is like the one below:
return strpos(str_replace('---', '.', $_SERVER['HTTP_HOST']), $host) === 0;