I want to create multistore website in magento2 for this my current system configuration is as follows-
- Web server: Nginx
- Magento Version: magento2.1.0
- Cento OS Version: 7
for this I have followed below steps:
Created Website/Store/View in magento2 admin.
Added below code in pub/index.php
$params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = [ DirectoryList::PUB => [DirectoryList::URL_PATH => ''], DirectoryList::MEDIA => [DirectoryList::URL_PATH => 'media'], DirectoryList::STATIC_VIEW => [DirectoryList::URL_PATH => 'static'], DirectoryList::UPLOAD => [DirectoryList::URL_PATH => 'media/upload'], ]; switch($_SERVER['HTTP_HOST']) { case 'electronics-dev.local': case 'www.electronics-dev.local': $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'electronics'; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website'; break; case 'magento2-dev.local': case 'www.magento2-dev.local': $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'base'; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website'; break; } $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params); /** @var \Magento\Framework\App\Http $app */ $app = $bootstrap->createApplication('Magento\Framework\App\Http'); $bootstrap->run($app);
7ochem
7,61516 gold badges54 silver badges82 bronze badges
1 Answer 1
To create websites and stores:
- Log in to the Magento Admin as a user authorized to create websites, stores, and store views.
- Click Stores> All Stores.
- To create a website, click Create Website.
- To create a store, click Create Store.
- To create a store view, click Create Store View.
- When you create your website or store view, make note of its unique identifier because you’ll use it later.
For more information http://devdocs.magento.com/guides/v2.1/config-guide/multi-site/ms_over.html
Mat Hellums
5022 silver badges12 bronze badges
default