Magento 2 Configuring multi-store local

Today I needed to create a multi-store quickly and in my local, in this same case just to test in Magento 1 we used to change the $mageRunCode and $mageRunType direct in the index.php to test something quickly in our local environment without using the right customization in the .htaccess or httpd.conf. In Magento 2 to test quickly you can use that code changing your index.php:

$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website_code';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
Rafael Corrêa Gomes

Rafael Corrêa Gomes

I’m Lead Software Engineer at Imagination Media Magento Partner, Magento Master 2018, 3x certified, open source evangelist.