We want to use one Magento backend for multiple stores and every store have normally 1 store view. We have 2 or more websites with 2 or more store views.

For German, we want to use the store code "de", for English "en" and so on. Now our problem is that every store code can't be used more than one times (is unique). When we get more websites and stores we must find for every a new store code.

Now one URL looks like this:

For a German store view, "mysite.com/deu/" or "mysite.com/de1/" and this is not fine. What can we do to solve this problem with the unique store codes?

Hope you can help me.

  • Why don't you use different domains for your websites so they can all have /de or /en etc? Commented Jun 20, 2014 at 15:53
  • We want only one magento backend for all stores. this is the problem.
    – no2br3ak
    Commented Jun 20, 2014 at 16:41
  • Its not a problem! :) You can use multiple domains for different websites or store views in magento, all using the same admin. Just enter the new domain where you would normally specify the base url after selecting your website scope in the top left of the admin. System > Configuration > web, i think. Commented Jun 20, 2014 at 17:06
  • But with this we can use the store code only one time
    – no2br3ak
    Commented Jun 23, 2014 at 8:17
  • That's fine, you're store code doesn't have to be the same as your url. so just use store1-de and store2-de, or similar. The store code must be unique Commented Jun 23, 2014 at 8:46

1 Answer 1


here is what I did in a similar case.
Let's say you have 2 websites with 2 store view each. both website have a EN and a DE store view (codes can be anything).

First create 2 folders in the root of your magento install with 2 subfolders each.

  • website1
    • en
    • de
  • website2
    • en
    • de

Then copy index.php and .htaccess into website1, website1/en, website1/de. Do the same for website2 and its subfolders.

Now edit index.php from all the folders and subfolders like this:

website1/index.php and website2/index.php

replace $mageFilename = MAGENTO_ROOT . '/app/Mage.php'; with $mageFilename = '../app/Mage.php'; and

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


 Mage::run('website code here for each website', 'website');

Then in the index.php of each of the de|en folders change $mageFilename = MAGENTO_ROOT . '/app/Mage.php'; to $mageFilename = '.././app/Mage.php';


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


 Mage::run('each store view code here', 'store');

Now remove the Show store codes in url flag.

In System->Configuration->web->unsecure set the these values

  • Base Skin URL : http://example.com/skin/ instead of {{unsecure_base_url}}skin/
  • Base Media URL : http://example.com/media/ instead of {{unsecure_base_url}}media/
  • Base JavaScript URL : http://example.com/js/ instead of {{unsecure_base_url}}js/

Do the same for the secure section if you are using secure urls just put https instead of http.

Now you have to create 2 virtual hosts, one for each website.
The document root for the first website will be website1 folder and for the second one website2.

If you want you can create only one folder website1 but this means that you have to create the en and de folders in the root folder of your magento instance for the second website and your second website has to have the document root, the root of your magento instance.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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