Magento: Setup Multiple Website

This step-by-step tutorial will guide you to create multiple websites in Magento.

I suppose that Magento is installed in the website’s root folder. Let’s assume the website URL to be your-website.com. Magento is already installed in your-website.com. Now, we will be setting up for new website from Magento admin.

Let our new website be your-new-website.com.

Create Website, Store, and Store View

1) Create Website

– Go to System –> Manage Stores
– Create Website
– Name = My Website
– Code = mywebsite
– Sort Order = 10
– Save Website

new website

2) Create Store

– Go to System -> Manage Stores
– Create Store
– Website = My Website
– Name = Main Store
– Root Category = Root Catalog

new website

3) Create Store View

– Go to System -> Manage Stores
– Create Store View
– Store = My Website -> Main Store
– Name = English
– Code = English
– Status = Enabled
– Sort Order = 10

new website

4) Change Base URL
– Go to System -> Configuration -> GENERAL -> Web
– Change ‘Current Configuration Scope’ to ‘My Website’
– Unsecure -> Base URL = http://your-new-website.com/

new website

5) (Optional) Change Theme: If you want different design for your new website

– Suppose your new design template and skin folder is named ‘mywebsite’
– Copy ‘mywebsite’ template folder to magento/app/design/frontend/default/
– Copy ‘mywebsite’ skin folder to magento/skin/frontend/default/

– Go to System -> Configuration -> GENERAL -> Design
– Change ‘Current Configuration Scope’ to ‘My Website’
– Themes -> Default = ‘mywebsite’
– Uncheck ‘Use Default’
– Save Config

6) Copy index.php of magento folder into your-new-website’s folder

– Open index.php of your-new-website folder
– Change


$compilerConfig = 'includes/config.php';` 

to


$compilerConfig = '../includes/config.php';

– Change


$mageFilename = 'app/Mage.php';

to


$mageFilename = '../app/Mage.php';

– Write


$mageRunCode = 'mywebsite'; // your new website's code
$mageRunType = 'website';

just before


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

7) Copy .htaccess file from magento folder to your-new-website’s folder

8) Create symbolic links for the following folders:


ln -s ../your-new-website/app ./app
ln -s ../your-new-website/errors ./errors
ln -s ../your-new-website/includes ./includes
ln -s ../your-new-website/js ./js
ln -s ../your-new-website/lib ./lib
ln -s ../your-new-website/media ./media
ln -s ../your-new-website/skin ./skin
ln -s ../your-new-website/var ./var

If you don’t have shell access, then you can do this with the help of PHP as well.


<?php
define('MAGENTO_ROOT', getcwd());

$realpath = realpath(MAGENTO_ROOT . '/../your-main-website-folder'); // main website means the base website directory

symlink($realpath.'/app', './app');
symlink($realpath.'/errors', './includes');
symlink($realpath.'/js', './js');
symlink($realpath.'/lib', './lib');
symlink($realpath.'/media', './media');
symlink($realpath.'/skin', './skin');
symlink($realpath.'/var', './var');
?>

– Write the above code in a PHP file.
– Upload it on your new website’s folder.
– Run it.
– This will create symbolic link on your new website’s folder.

That’s all.

Finally, you have created a new website for your magento shop. Your base installation can be browsed by http://your-website.com/ and your new website can be browsed by http://your-new-website.com/

Hope this helps. Thanks.