Multi-website multi-store set-up

The question:

I have a client who is in need of a store with multiple, independent currency rates. They cannot use the default rate functionality of Magento due to them needing bespoke prices for each currency and product.

To battle this we decided to create a website per currency. However, we also need two store groups and store views for each site. Is there a way to set-up Magento whereby it would be something like the following:

I have read of many ways to do each separately (i.e. domain per website and subfolder per store) but not of having both in the URL.

The way I was looking to do this was with a symlink, but I just can’t wrap my head around where to start!

Any help would be appreciated, thank you.

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

I used to do it like this:
create the folders website1/store1, website1/store2, …
Then, in the folder website1 clone the index.php and .htaccess from the rood folder and replace this in index.php

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


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

and replace

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

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


Mage::run('website1_code_goes_here', 'website');

Do the same for the folder website2 but change the code accordingly on the last line I mentioned.

Then copy the same files in the folder website1/store1 and change

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


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


/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';

/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';

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


Mage::run('store1_id_goes_here', 'store');

Do the same for the other store folders (website1/store2, website2/store1, website2/store2) adjusting the last line accordingly.

Then you will have to go to System->configuration->web->unsecure in the backend, select from the top left selector, website1 and fill in the base url field to Do the same for base link url.
and for media base url fill in The same goes for skin and js urls.

Do the same for website 2.
Then select from the top left selector the store view store1.
Fill in the base url to and the same for base link url. I don’t think there is a need to change the values for base media/skin/js url.
Do the same for the 3 others store views.

Clear the cache and give it a go.

Method 2

Create a Websites and it’s relevant Store and StoreView from Admin > Stores > All Stores
Go to Stores > Configuration, Select website which you have created. Then Go to Web and change both Base URLs & Base URLs (Secure)

For example : e.g. Base URL: (Main website url keep as it is) Base Link URL: {{unsecure_base_url}}web2/

Here, web2 is a sub directory folder which needs to create under your magento root folder

Create a sub directory folder, then copy index.php & .htaccess from root

Open index.php replace everything with the code bellow:

require realpath(__DIR__) . '/../app/bootstrap.php';
$params = $_SERVER;
$params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = 'web2_website'; 
$params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = 'website'; 
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
$app = $bootstrap->createApplication('MagentoFrameworkAppHttp');

web2_website is a website code.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment