Magento 1.9 multiple websites on different domains

You don't need to have multiple directories for multiple domains if you are using single magento instance to fulfill your requirements.

Step 1: Point all domains to Magento root directory, i.e. same document root in the webserver (Apache or Nginx) configuration.

Step 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.

Step 3: Set store or website for each domain as environment variable in .htaccess or in the webserver configuration.

  • Example with the websites as given in the question:

    SetEnv MAGE_RUN_TYPE website
    SetEnvIf Host abc\.com MAGE_RUN_CODE=domain1
    SetEnvIf Host xyz\.com MAGE_RUN_CODE=domain2
    
  • Example with store views instead of websites

    SetEnv MAGE_RUN_TYPE store
    SetEnvIf Host abc\.com MAGE_RUN_CODE=store_code_1
    SetEnvIf Host xyz\.com MAGE_RUN_CODE=store_code_2
    

    These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace abc\.com with ^abc\.com$

Step 4: Clear cache and access your domains.


You can find how to setup multiple storefronts on one Magento installation by following: http://www.ecommercegorilla.com/how-to-set-up-multiple-store-fronts-with-magento/

This method works for any store post Magento CE 1.4

Look to the end of the article you will see there are two methods, one that uses separate directories for each domain and a second method that allows you to use pointer domains.

If you are looking to have customers checkout on the store domain and not one shared domain under SSL you will want to use the separate directories method. It describes how to setup the symbolic links so the store will properly pull files and how to modify the the index.php of each store to assign the correct website/store code.


You should copy index.php and .htaccess files on your second domain directory.

After that:

Open up the index.php file and look for this line (it's the last line of the file):

Mage::run($mageRunCode, $mageRunType);

Add the following code right before the above code:

$mageRunCode = 'YOUR_WEBSITE_CODE';

$mageRunType = 'website';

Lastly, you need to create symbolic links to point to a few directories:

ln -s your_magento_root_directory/app ./app

ln -s your_magento_root_directory/errors ./errors

ln -s your_magento_root_directory/includes ./includes

ln -s your_magento_root_directory/js ./js

ln -s your_magento_root_directory/lib ./lib

ln -s your_magento_root_directory/media ./media

ln -s your_magento_root_directory/skin ./skin

ln -s your_magento_root_directory/var ./var

Source: http://www.crucialwebhost.com/kb/how-to-setup-multiple-magento-stores/