0

This question already has an answer here:

i am searching complete guide to setup multidomain guide, specially changes in index.php and .htaccess, what i find in google search is here, but its not complete

Blockquote

 switch ($_SERVER['HTTP_HOST']) {
    case 'www.aaa.nl':
    case 'aaa.nl':
        $params = $_SERVER; $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); 
        $app = $bootstrap->createApplication('Magento\Framework\App\Http'); 
        $bootstrap->run($app); 
        break; 
    case 'www.bbb.nl':
    case 'bbb.nl':
        $params = $_SERVER; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'uspnl'; 
        $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); 
        break; 
    case 'www.ccc.nl':
    case 'ccc.nl':
        $params = $_SERVER; $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'tidnl'; 
        $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); 
        break;

    default: 
        Mage::run(); 
    break; 
}

Blockquote


Please clear this enough what should do in .htaccess ?? or there need to make sudir i mean for other website ?

marked as duplicate by Priyank, Jai, Manoj Deswal, Manashvi Birla, sv3n Mar 16 '18 at 13:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

You don't have to anything in index.php, just add following in .htaccess or in your apache hosts file:

#first website with www or without www
SetEnvIf Host ^www\.aaa\.nl MAGE_RUN_CODE=base
SetEnvIf Host ^www\.aaa\.nl MAGE_RUN_TYPE=website
SetEnvIf Host ^aaa\.nl MAGE_RUN_CODE=base
SetEnvIf Host ^aaa\.nl MAGE_RUN_TYPE=website

#second website 
SetEnvIf Host ^www\.bbb\.nl MAGE_RUN_CODE=uspnl
SetEnvIf Host ^www\.bbb\.nl MAGE_RUN_TYPE=website
SetEnvIf Host ^bbb\.nl MAGE_RUN_CODE=uspnl
SetEnvIf Host ^bbb\.nl MAGE_RUN_TYPE=website

#third website 
SetEnvIf Host ^www\.ccc\.nl MAGE_RUN_CODE=tidnl
SetEnvIf Host ^www\.ccc\.nl MAGE_RUN_TYPE=website
SetEnvIf Host ^ccc\.nl MAGE_RUN_CODE=tidnl
SetEnvIf Host ^ccc\.nl MAGE_RUN_TYPE=website

In apache hosts file you can put above code directly inside <VirtualHost *:80> before <Directory /var/www/html>.

In htaccess

  • Thanks for response, 2nd &3rd domain dir will be blank or there need copy index.php n htaccess file edit them as per requirment – PsmIndia Mar 16 '18 at 9:48

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