cancel
Showing results for 
Search instead for 
Did you mean: 

Multi Shop issue with domain and subdirectories

Multi Shop issue with domain and subdirectories

Hi all!

 

I created a Magento 2 instance and I try to configure it as follows:

 

www.mydomain.com <- Main store

www.mydomain.com/uk/ <- United Kingdom store

www.mydomain.com/nl/ <- Dutch store

 

The main store works fine, but both the other stores give a 404 error. We use NGINX, in the configuration I passed on the run type and run code parameters and these arrive in the code just fine.

 

I rewrite the URLs in NGINX config like this:

 

        rewrite /nl/(.*)$ /$1 break;
        rewrite /uk/(.*)$ /$1 break;

and I mapped the store codes and pass them as FastCGI params.

 

We use the /pub/ folder as webroot. In the Index I added this code (instead of the standard version):

 

    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = $_SERVER['MAGE_RUN_CODE']; 
    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = $_SERVER['MAGE_RUN_TYPE'];
    
    $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
    $app = $bootstrap->createApplication('\Magento\Framework\App\Http');

    $bootstrap->run($app);

I configured every store with the right Base URL, configured a home page for every store view separately.

 

What am I missing?