I am working on Magento ver. 2.1.7 and my document root is /var/www/magento2/ and site URL http://172.16.60.52/magento2/
In the admin menu Stores -> Settings -> All Store I have created One Main Website and two store for Electronic and Fashion . Also I have created store view for each store having code electronic and fashion respectively.
In the admin section I have set the following configurations
Stores - > Settings -> Configuration -> General -> Web -> (Store View: Default Config) Add Store Code to Urls - > Yes
Stores - > Settings -> Configuration -> General -> Web -> (Store View: Electronic)
Base URL -> http://172.16.60.52/magento2/electronic/
Base Link URL -> http://172.16.60.52/magento2/electronic/
Secure Base URL -> http://172.16.60.52/magento2/electronic/
Secure Base Link URL -> http://172.16.60.52/magento2/electronic/
Stores - > Settings -> Configuration -> General -> Web -> (Store View: Fashion)
Base URL -> http://172.16.60.52/magento2/fashion/
Base Link URL -> http://172.16.60.52/magento2/fashion/
Secure Base URL -> http://172.16.60.52/magento2/fashion/
Secure Base Link URL -> http://172.16.60.52/magento2/fashion/
I have created two directories electronic & fashion in document root, copied index.php and .htaccess files from magento2 directory to electronic and fashion directory
I have change the /var/www/magento2/electronic/index.php file as code given below...
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'electronic';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);
Also, I have change the /var/www/magento2/fashion/index.php
file as code given below...
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'fashion';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);
While accessing url http://172.16.60.52/magento2/electronic/
we got the following error
There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: 876098939040
Log file info :
a:4:{i:0;s:15:"No such entity.";i:1;s:4915:"#0 /var/www/magento/ehgsdigi/vendor/magento/module-store/Model/StoreResolver/Website.php(46): Magento\Store\Model\WebsiteRepository->get('electronic')
...................
Please advice me