0
votes

We have a magento site with multi stores feature. We have setup multiple stores on different domains. My main website home page is working fine but on second store home page shows 404 page.

I have checked all configuration in admin panel and all seems correct. Further I investigate and found that instead of CMS controller it is calling product controller 'product/view/id/2057'

Can anyone help me to resolve this error?

Thanks in advance

1
Have you gone through each setting in the configuration while changing the configuration scope? - Frederik Krautwald
Yes. I have checked everything with website scope but no success. - Ann
Have you tried changing to the default theme to see if the problem persists? - Frederik Krautwald
Sounds to me like the CMS Homepage is not set to both stores, check CMS scope again maybe? - user3154108

1 Answers

-1
votes

It seems to be the same issue mentioned here, check it out,

2nd Answer: https://magento.stackexchange.com/questions/202135/magento-2-multistore-url-giving-404-error

========================

There are 2 solution for that you can follow which one liked to use :-

First Option

System -> Configuration -> Web -> Url Options -> Add Store Code to Urls

Set Yes to this options, your store code will automatically append on store switch, flush caches. This solution credit goes to @Priyank

Second Option

1) Create store view.

2) select France store from admin panel and change base url, base link url, Secure base url, Secure base link url from admin panel (Stores -> Configuration -> General -> Web) :

http://example.com/business/fr/

3) Create folder in root directory with name fr

4) Copy htaccess & index.php from root

5) Replace index.php code following code

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
 /** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);

With Below code

$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'fr'; 

//store code as same in admin panel

$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'store';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);

6) Create symlinks

ln -s /var/www/html/http://example.com/business/app/ app 
ln -s /var/www/html/http://example.com/business/lib/ lib 
ln -s /var/www/html/http://example.com/business/pub/ pub 
ln -s /var/www/html/http://example.com/business/var/ var 
Here /var/www/html/http://example.com/business/ 
is path of your project to root directory change as per your own configuration.

Don't forgot flush cache.

===============================

Cheers, Dasitha.