Pack Hosting Panel

Configure Magento multistore

What is a multistore and how do you configure one at Hipex?

What is a multistore?

Magento offers you the possibility to set up a so-called multistore. It implies that you can connect multiple domains to loose Magento installations. Every domain gets its own ‘store view’ at its disposal. Store views are usually used to represent a shop in multiple languages, although storeviews can also be used to represent, for example, several different shops within one installation.

How do I configure a multistore at Hipex?

At Hipex we offer you the possibility to configure a multistore easily. To ensure every domain name is on the right store view, we can configure this with Nginx configurations. You can do this in two ways:

  • Configuration based on the ‘magento-storecode’ configuration file
  • Configuration based on the Nginx ‘folder’ mode.

Below we will explain those two options further.

Map storecodes

First of all, we would like to explain how to configure various store views by the means of the default magento store code Nginx configuration files. Therefore, you can follow the next steps:

Log in to the environment

Log in with SSH to the concerned environment.

Navigate to the codebase

To map the available store codes, we need to navigate to the codebase of the Magento installation first. Typically, this will be one of the default locations:

  • Magento 1: /home/<username>/domains/<domainname>/public_html/
  • Magento 2: /home/<username>/domains/<domainname>/application/

Map available storecodes

To request the available store codes there can be made use of Magerun. For the different versions of Magento, it concerns the following commands:

  • Magento 1 : magerun sys:store:list
  • Magento 2 : magerun2 sys:store:list

Running a Magerun command results to a list of storecodes:

| id | code         |
| 1  | nl           |
| 2  | de           |

Configuration based on the Magento storecode file

Now we have mapped the storecodes, we can configure the desired store. Navigate to the following location: /home/<username>/domains/<domainname>/var/etc/domainname.de/ At this location, you will find a file named ‘magento-storecode.nginx.conf‘. Then open this file. We can enter the desired storecode as a value at:

set $mage_run_code 'default';

Imagine, we would like to show the domain name of the German store, we change ‘default’ by ‘de’. After that, we delete the hashtag (#) again for the concerning lines. The final configuration will look like this:

# Magento store code example configuration file
# To set domain run type to store and code to default uncomment following lines

set $mage_run_type 'store';
set $mage_run_code 'de';

Of course we need to reload the Nginx configuration with the command nginx-reload.

Configuration on the basis of the folder module

In addition to the above described method, we can also use the Nginx folder module to configure storecodes. To do so, navigate to the following location: /home/<username>/domains/<domainname>/var/etc/scope-http/

At this location, we can create a file called ‘map.nginx.conf‘. In this file, all desired configurations can be stored. In our example, we are going to ensure that ‘domeinnaam.de’ ends on the store view with the storecode ‘de’.

map $host$request_uri $mapped_mage_run_code {
    domeinnaam.de          de;
    *.domeinnaam.de        de;

The variable '$mappedmagerun_code' is now filled with the concerned storecode. We then assign the filled variable '$mappedmagerun_code' to '$mageruncode, as the variable is used in Magento. For this we can add the following line to the file /home/<username>/domains/<domainname>/var/etc/magento.nginx.conf:

set $mage_run_code $mapped_mage_run_code;

After adding, we can reload the Nginx configuration with the command nginx-reload, now the domainname.de will land on the German store view.