I have installed Magento on one domain - domain2.biz, and stores look like this:
WEBSITE • STORE • STORE VIEW
domain1 • domain1.com • domain1_view
domain1 • domain2.biz • domain2_view
domain3 • domain3.net • domain3_view
I added to the index.php file:
switch($_SERVER['HTTP_HOST']) {
case 'domain2.biz':
case 'www.domain2.biz':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'domain1';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
break;
case 'domain1.com':
case 'www.domain1.com':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'domain1';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
break;
case 'domain3.net':
case 'www.domain3.net':
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'domain3';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
break;
}and the .htaccess file:
SetEnvIf Host www\.domain3\.net MAGE_RUN_CODE=domain3
SetEnvIf Host www\.domain3\.net MAGE_RUN_TYPE=website
SetEnvIf Host ^domain3\.net MAGE_RUN_CODE=domain3
SetEnvIf Host ^domain3\.net MAGE_RUN_TYPE=website
RewriteCond %{HTTP_HOST} .*domain3\.net [NC]
RewriteRule .* - [E=MAGE_RUN_CODE:domain3]
RewriteCond %{HTTP_HOST} .*domain3\.net [NC]
RewriteRule .* - [E=MAGE_RUN_TYPE:website]
SetEnvIf Host www\.domain2\.biz MAGE_RUN_CODE=domain1
SetEnvIf Host www\.domain2\.biz MAGE_RUN_TYPE=website
SetEnvIf Host ^domain2\.biz MAGE_RUN_CODE=domain1
SetEnvIf Host ^domain2\.biz MAGE_RUN_TYPE=website
RewriteCond %{HTTP_HOST} .*domain2\.biz [NC]
RewriteRule .* - [E=MAGE_RUN_CODE:domain1]
RewriteCond %{HTTP_HOST} .*domain2\.biz [NC]
RewriteRule .* - [E=MAGE_RUN_TYPE:website]
SetEnvIf Host www\.domain1\.com MAGE_RUN_CODE=domain1
SetEnvIf Host www\.domain1\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^domain1\.com MAGE_RUN_CODE=domain1
SetEnvIf Host ^domain1\.com MAGE_RUN_TYPE=website
RewriteCond %{HTTP_HOST} .*domain1\.com [NC]
RewriteRule .* - [E=MAGE_RUN_CODE:domain1]
RewriteCond %{HTTP_HOST} .*domain1\.com [NC]
RewriteRule .* - [E=MAGE_RUN_TYPE:website]Unfortunately, the only working store is the one on whose domain Magento has been installed (domain2.biz).
Should I upload some files for the other two domains? Additional domains are not configured (they do not have any files).
What file should be there and what should it contain?
Is it possible that it works ONLY with virtual hosts?