2

I am trying to set up my local mac to have 2 stores in 1 magento instance

The main domain (www.mydomain.dev) is working as expected however the french domain (www.mydomain-fr.dev) is not loading and giving me

1 exception(s):
Exception #0 (Exception): Notice: Undefined index: store; in /Users/myuser/Sites/mydomain/vendor/magento/module-store/Model/StoreResolver/ReaderList.php on line 50

Please could anyone advise? My vhost.conf looks like the following if it helps

 <VirtualHost *:443>
 ServerName mydomain.dev
 ServerAlias *.mydomain.dev
 Include "/Users/myuser/Sites/ssl/ssl-shared-cert.inc"
 CustomLog "/Users/myuser/Sites/logs/dev-access_log" combinedmassvhost
 ErrorLog "/Users/myuser/Sites/logs/dev-error_log"
 VirtualDocumentRoot /Users/myuser/Sites/mydomain
 </VirtualHost>
 <VirtualHost *:443>
 ServerName mydomain-fr.dev
 ServerAlias *.mydomain-fr.dev
 Include "/Users/myuser/Sites/ssl/ssl-shared-cert.inc"
 SetEnv MAGE_RUN_CODE frenchstore_view;
 SetEnv MAGE_RUN_TYPE store;
 CustomLog "/Users/myuser/Sites/logs/dev-access_log" combinedmassvhost
 ErrorLog "/Users/myuser/Sites/logs/dev-error_log"
 VirtualDocumentRoot /Users/myuser/Sites/mydomain
 </VirtualHost>

EDIT

If I update the index.php in root from:

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);

To

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

Then the french domain works. Am I meant to be editing the index.php?

The store hierarchy is the following

Main website UK Store UK Store View
Main website French Store French Store View
asked Jan 21, 2018 at 12:50
3
  • Could you share the hierarchy in terms of websites, stores and views? Commented Jan 21, 2018 at 14:03
  • I have updated the question with in it, hope this helps Commented Jan 21, 2018 at 14:06
  • I could give you an answer... but it would include certain guesswork, could you also add the code (available when you press on the web site, store and store view links available in admin at Stores > All stores) and which is the default? As of now, my guess is that you override whatever you set in htaccess / vhost.conf in index.php; your .dev domain doesn't work - you get the french no matter what? Commented Jan 21, 2018 at 17:30

1 Answer 1

0

In OP post apache vhost config is incorrect

SetEnv MAGE_RUN_CODE frenchstore_view;
SetEnv MAGE_RUN_TYPE store;

Parameters should be in double-quotes and no semicolons.

Correct one:

SetEnv MAGE_RUN_CODE "frenchstore_view"
SetEnv MAGE_RUN_TYPE "store"
answered Dec 21, 2019 at 17:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.