I Have created form backend a new Website with his own Store and Store View

I have already set for my new Store View : Base URLs - Base URL and Base Link URL with the new link: for example : http://clubshop.testwswear.com/ (same value for both fields) and the same thing set for the Base URLs (Secure)

After this I have followed this steps form this answer: Create Multi Website/Stores in magento 2 accepted one ) and after all, when I try to access my new link it redirect me on the defaul store view link.

Does anyone know what I did wrong? or why it redirect me all the time?

Thank you in advance!

1 Answer 1


I solve my problem by adding in my index.php:

$host = $_SERVER['HTTP_HOST'];
$params = $_SERVER;
if (strpos($host,'clubshop')) {
    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'web_shop';
    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
} else {
    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'base';
    $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');

So my new shop web site contain the name clubshop found in backend at Web Site Information ->code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.