1

I have a new Magento 2.1 CE setup. I want to offer localised versions (currency) of our website. US would only allow us dollar currency, UK would only allow british pounds currency etc. So have set up:

[Website]        [Store]       [Store View]

Main Website     Main Store    Global
Main Website     Main Store    UK
Main Website     Main Store    US
Main Website     Main Store    CA

In index.php:

$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'global';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'store';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);

In .htaccess file:

RewriteCond %{HTTP_HOST} ^(.*)shop\.com
RewriteRule .* – [E=MAGE_RUN_CODE:global]
RewriteCond %{HTTP_HOST} ^(.*)shop\.com
RewriteRule .* – [E=MAGE_RUN_TYPE:store]

RewriteCond %{HTTP_HOST} ^(.*)shop\.us
RewriteRule .* – [E=MAGE_RUN_CODE:us]
RewriteCond %{HTTP_HOST} ^(.*)shop\.us
RewriteRule .* – [E=MAGE_RUN_TYPE:store]

RewriteCond %{HTTP_HOST} ^(.*)shop\.ca
RewriteRule .* – [E=MAGE_RUN_CODE:ca]
RewriteCond %{HTTP_HOST} ^(.*)shop\.ca
RewriteRule .* – [E=MAGE_RUN_TYPE:store]

RewriteCond %{HTTP_HOST} ^(.*)shop\.co.uk
RewriteRule .* – [E=MAGE_RUN_CODE:uk]
RewriteCond %{HTTP_HOST} ^(.*)shop\.co.uk
RewriteRule .* – [E=MAGE_RUN_TYPE:store]

However, on its own this does not seem to do anything. As soon as I change base url for a store view, I get error pages or a 404 on homepage and am unable to enter the admin panel.

Please can someone help as to how this is done properly?

Documentation Followed:

http://devdocs.magento.com/guides/v2.1/config-guide/multi-site/ms_over.html http://devdocs.magento.com/guides/v2.1/config-guide/multi-site/ms_apache.html

  • you found a solution for this? – Mer Gh Apr 18 '18 at 19:39

Your Answer

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

Browse other questions tagged or ask your own question.