This guide explains how to configure your Magento 2 multi-site to work on STORM. Please note these steps have been provided to us by a number of our clients who are using Magento 2 multi-sites on STORM.


Before getting started make sure you have set up your websites, stores, and store views in your sites admin dashboard. For more information on how to do this please visit the link below:


https://devdocs.magento.com/guides/v2.3/config-guide/multi-site/ms_websites.html


You will also need to make sure you have added the additional domains to STORM under your sites dashboard > Additional Domains 



Steps


In order for your different stores views to display correctly on STORM you will need to add some additional code to your sites index.php file.


For added security STORM sets the default document root for Magento 2 sites to /pub. Therefore you may need edit the index.php file inside the /pub folder.


Once you have opened your index.php file and look for the following:


$params = $_SERVER;


The multi-site code should be added after this line.


The below example shows how to add 2 additional sites to your Magento 2 site. In this case "secondomain.com" & "thirddomain.com".


You will need to add the code snippet as listed below. Change the store_code_two and store_code_three lines to match the store code that you have set up in your Magento Store Settings. 


switch($_SERVER['HTTP_HOST'])  {
 case 'seconddomain.com':
     $mageRunCode = 'store_code_two'; // found in Stores / All Stores
     $mageRunType = 'website'; // store or website
 break;
 
 case 'thirddomain.com':
     $mageRunCode = 'store_code_three';
     $mageRunType = 'website';
 break;
 
 default:
     $mageRunCode = 'default';
     $mageRunType = 'website';
 break;
 }
 
 $params = $_SERVER;
 
 $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = $mageRunCode;
 $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = $mageRunType;


To add more sites to the config, simply mirror the existing lines between "case" and "break" adding your new domains and store codes as required:


 case 'fourthdomain.com':
$mageRunCode = 'store_code_four'; // found in Stores / All Stores
$mageRunType = 'website'; // store or website
break;