Today we’ll show you a simple way to create a multistore in Magento – if you’re curious how to do it, read on!

The solution described in this article works only for Apache www servers.

Magento has a “Multistore” function, which enables us to have several stores within one installation, more or less independent from each other. The configuration is here the key to specify the extent to which they are independent: we can have stores with, for example, various interface languages, different products or layout.

There are many ways to handle the multistore functionality. We’ll focus on the easiest solution that uses suffixes. Let’s take a look at the following example:

“Examply” is a small store that sells products across Europe and has two language versions – German and English.

The solution using the suffixes instead of domains is often cheaper (there’s no need to pay for additional domains), simpler (if you use our solution) and better in terms of SEO – the store’s rate is not divided into several domains.

The German version of the store can be found under https://examply.com, while its English version under https://examply.com/en.

As you must have noticed, the address of the English version contains the “/en” suffix.

In order to achieve such result, it’s not enough to simply build a German store with the address “https://shop-a.example.com/de” – Magento won’t assign the address to the store on its own, so when we go to this address, we’ll get the 404 error. We could use the “Add Store Code To URLs” option, but then the English version of the store would have a suffix, such as “/default”, which doesn’t look very good. Moreover, using this option often causes problems.

Our solution boils down to a few simple steps:

1. Configure the second store.
1.1. Go to System -> Manage Stores.
1.2. Click Create Store View.
1.3. Give the name “English”, code “en”, set the status as “Enabled” and click Save Store View.
1.4. Go to System -> Configuration.
1.5. Select Web in the menu on the left.
1.6. Make sure that the Add Store Code To URLs in the URL Options tab is set as “Disabled”.
1.7. Change the Current Configuration Scope to “English”.
1.8. Unselect “Use Website” in the Unsecure and Secure tabs and add the “/en” suffix to the field; then click Save Config.

You can input any name and any code you wish, but remember to modify the name of the subfolder and the value of the MAGE_RUN_CODE variable so that it corresponds to the store’s code.

2. Create the “en” subfolder in the main folder of the Magento installation.

3. Add the “index.php” file to the “en” subfolder:
$_SERVER[‘MAGE_RUN_CODE’] = ‘en’;
$_SERVER[‘MAGE_RUN_TYPE’] = ‘store’;
require ‘index.php’;

4. Copy the “.htaccess” file from the main folder to the “en” subfolder.
[hint] If you modified the original .htaccess file, check whether there aren’t any additional rewrites (that might not work in the subfolder) and whether the correct value is set for the RewriteBase directive. [/hint]

5. Add symlinks to the “en” folder:

$ ln -s ../app app
$ ln -s ../includes includes
$ ln -s ../js js
$ ln -s ../lib lib
$ ln -s ../media media
$ ln -s ../skin skin
$ ln -s ../var var

[hint] Your www server has to be appropriately configured. If you don’t have the option “FollowSymLinks” or “SymLinksIfOwnerMatch”, the solution won’t work. In case of the second option, make sure that the owner of the symlink’s source and target is coherent. You can change the source owner using: $ chown USER -h FILE. [/hint]

6. Now you can enjoy your second store that can be found under the new address: https://examply.com/en!