This post suggest how you should configure the index file to run multiple stores and assumes that you have confifured your domains properly.
Here we have:
1. en.domain.com/ for English users
2. dk.domain.com/ For Danish Users
The two domains/sub domains should point to the same folder on your web server.
.htaccess. Add this lines appropriately.
RewriteCond %{HTTP_HOST} ^(.*)en\.domain.\com
RewriteRule .* – [E=MAGE_RUN_CODE:en]
RewriteCond %{HTTP_HOST} ^(.*)en\.domain.\com
RewriteRule .* – [E=MAGE_RUN_TYPE:website]
RewriteCond %{HTTP_HOST} ^(.*)dk\.domain.\com
RewriteRule .* – [E=MAGE_RUN_CODE:dk]
RewriteCond %{HTTP_HOST} ^(.*)dk\.domain.\com
RewriteRule .* – [E=MAGE_RUN_TYPE:website]
index.php: In your index.php file, replace with the following
$params = $_SERVER;
switch ($_SERVER['HTTP_HOST']) {
case 'nautical-antiques.eu':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'en';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
break;
case 'nautikvariat.dk':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'dk';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
break;
}
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);
en and dk are the codes for magento websites.