Multiple websites or stores in Magento 2.0


One of the useful features of Magento 2.0 is the ability to create multiple stores/websites that share the same MBO (Magento Back Office). This allows multiple store fronts to share a common code base and backend making its administration a lot easier. Stores can share customer base, product catalogue and settings based on how you choose to configure your sites.
This tutorial will help you to go through the steps of setting up multiple stores in Magento 2.0, and how to configure a domain for each store.

How to create a store in MBO?

The first step in setting up multi-store functionality is to create the new store or stores in the Magento administrator application.

Follow the steps below to create a new store:

  • Log in to the Magento Administrator Panel (MBO)
  • Navigate to Stores > All Stores


  • Click Create Web Site


  • In the Name field, enter your new store/website name.
  • In the Code field, enter a unique string without spaces and click on Save Web Site. Retain this code for later use.


  • Click Create Store button
  • In the Web Site field, select the website that created in above steps (5)
  • In the Name field, enter a name of store
  • In the Root Category field, select the root category and click Save Store button


  • For root category, MBO can create new root category/subcategory and assign here
  • Click Create Store View
  • In the Store field, select the store created in above steps. In the Name field, give your view a name such as "new store view"
  • In the Code field, enter a unique string to identify the store view. Change the Status to Enabled and click Save Store View button


  • Click Stores > Configuration
  • In the Store View field, select the website that you just created


  • Select the Web menu option, and click to expand the Base URLs and Base URLs (Secure)
  • In Base URLs enter your new store http url


  • Click Save Config button

How to configure store on the server to load the new storefront (

    • Create new subdomain and new virtual host for (80 and 443)
    • Create new folder in /var/www/html/store2 and copy .htaccess and index.php from Magento root
    • directory to new store2 folder.
    • Open index.php from new store2 folder and edit the following lines:


$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = bootstrap->createApplication('Magento\Framework\App\Http');


$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'newstoreview'; //store view code set in admin panel
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'newstore'; //website code set in admin panel
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');

  • Using SSH, create the following symbolic links in the document root of your new domain, and replace the path below with the full path to the document root of your Magento Installation:

ln -s /var/www/html/store1/app/ app
ln -s /var/www/html/store1/lib/ lib
ln -s /var/www/html/store1/pub/ pub
ln -s /var/www/html/store1/var/ var

  • Then, execute following command.

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento index:reindex
php bin/magento cache:flush

Now you have successfully completed your new store configuration. You can now browse your new domain at

If you face any challenges while creating stores in Magento 2.0, feel free to drop a comment below.

Topics: e-commerce Digital Commerce Magento 2.0

e-Zest Solutions is digital experience engineering company with facilities in the United States (Detroit & San Jose), Germany (Hannover), United Kingdom (London UK) and India (Pune) with global clientele. Our services include custom software development, offshore software development, UX consulting, BigData, Managed cloud Services (Azure & AWS), SharePoint consulting/Migration, Enterprise Java application development, Automated software testing services.