This is One of Magento’s best and popular features of magento which allows to run
Multiple website with multiple domain name in a single magento.To configure multiple website or multiple domain Follow the below process.

Create 2 or more website, Store and store view from System-> Manage Stores

See the below screenshot
Now go to System->Configuration->Web
From Current Configuration Scope: Select your first website i.e website1. Then from Unsecure tab change your Base URL from {{base_url}} to your domain name (e.g

Do the same for Website2 and website3 by selecting website2 and website3
From Current Configuration Scope:
Below 3 screenshot shows how to do this

Now open your magento Index.php file which you will found in your magento root folder. open it and comment the below code

$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run($mageRunCode, $mageRunType);

And paste the below code

switch($_SERVER['HTTP_HOST']) {
case '':
Mage::run('website1', 'website');
/* website1 is the code you wrote in the admin when created the website */
case '':
Mage::run('website2', 'website');
case '':
Mage::run('website3', 'website');