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
Best Answer
In OP post apache vhost config is incorrect
Parameters should be in double-quotes and no semicolons.
Correct one: