DEV Community

Rafael Corrêa Gomes
Rafael Corrêa Gomes

Posted on • Originally published at rafaelstz.github.io

3

Configure a local Magento 2 multi-store

When we have to configure a multi-store in your local machine you can configure the local NGINX or Apache configuration to make it work, or you can quickly change your index.php just to test, fix the issues and not commit this change.

In this same case just to test using Magento 1 we used to change the $mageRunCode and $mageRunType in the .htaccess or httpd.conf.
In Magento 2 to test quickly you can use that code into 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);
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay