0

Can someone shed some light on Magento 2.1.3 enabling multistore?

things I have tried;

enabling index.php code is dev website url is dev.example.com

<?php
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'dev.dev.example.com';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);
?>

enabling .htaccess with index.php code is dev website url is dev.example.com

RewriteCond %{HTTP_HOST} ^(.*)dev\.example\.com
RewriteRule .* – [E=MAGE_RUN_CODE:dev.dev.example_com]
RewriteCond %{HTTP_HOST} ^(.*)dev\.example\.com
RewriteRule .* – [E=MAGE_RUN_TYPE:website

enabling vhost.conf with index.php code is dev website url is dev.example.com

SetEnv MAGE_RUN_CODE "dev.dev.example.com"
SetEnv MAGE_RUN_TYPE "website"

enabling index.php and old .htaccess

SetEnvIf Host dev\.example\.com MAGE_RUN_CODE=dev_example_com
SetEnvIf Host dev\.example\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^example\.com MAGE_RUN_CODE=dev_example_com
SetEnvIf Host ^example\.com MAGE_RUN_TYPE=website

have tried enabling vhost with .htaccess and index.php and vhost with .htaccess the old .htaccess and index.php

all of which have produced a Magento 500 error or the servers internal server error page

Also, have tried uncommenting this section of the index.php page. Although didn't give me any errors it isn't working correctly either. For example, I have removed a category from displaying in the header for this site and it still shows up like in default site. Also tried with .htaccess and as well.

require __DIR__ . '/app/bootstrap.php';
 $params = $_SERVER;
 $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'example.com';
 $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'dev.example.com';
 $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
3
  • Did you add those coding to your non-default store index.php file?
    – Wasim
    Aug 1 '17 at 8:35
  • Added it to things I have tried :)
    – jmituzas
    Aug 2 '17 at 15:48
  • Can you please provide the actual error message? Aug 11 '17 at 17:44
1

This is likely due to a bug in 2.1.3 that prevented website scope configurations from working - https://github.com/magento/magento2/issues/7943

I'd suggest that you upgrade your installation to 2.1.7 and see if the issue still occurs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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