5

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:

  1. Created Website/Store/View in magento2 admin.

  2. 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
asked Jul 13, 2016 at 10:07
0

1 Answer 1

2

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
answered Jul 13, 2016 at 11:04
0

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.