This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

📣 Try the fastest hosting platform with pay-as-you-go pricing & 24/7 expert support! MIGRATE NOW →

How To Create & Configure Magento 2 Multistore

Updated on October 27, 2023

12 Min Read
Magento Multistore Configuration

Want to run multiple Magento 2 stores simultaneously? You can simply do so by enabling Multistore for Magento 2.

This will let you run and manage several Magento stores concurrently – from a single admin panel.

Doesn’t matter if you want them to be subcategories of a single store or if you want to run them as separate entities on different URLs altogether.

Whether you’re someone who owns multiple Magento stores or a Magento agency that wants easy client management, setting up a multistore can be an amazing option for you.

In this article, I’ll show you exactly how to do it in just 9 easy steps. I’ve also covered the common problems that you may encounter in the process and how to resolve them.

Benefits of Using Magento 2 for Multistore

Before getting to the steps, let’s have a look at some benefits you get from setting up Magento 2 multistore.

1. Easy to Customize Multiple Stores:

You can manage and customize all your stores simultaneously with a single admin panel. Different themes, settings, and payment options exist for all the stores, all from a single management point.

This saves so much time and effort. You can also cater to customers in different geographical locations by setting different languages for different stores.

2. Reduced Operational Costs:

Managing everything from one admin panel will significantly reduce your store’s operational costs. You won’t require additional personnel to handle various tasks, and expenses on extensions and third-party integrations will be minimized.

3. Easy Customer Management:

All the data from different stores will be consolidated on your admin panel. You can better track customer behaviors for different stores and get insights for future strategies.

4. A Better Way to Keep Track of the Financials:

In the same vein as customer management, tracking your financial metrics becomes way easier than gathering data from different sources and getting it in one place. Revenues, taxes, profits, costs, etc., all the numbers come in one place because of multistore management.

5. One-stop SEO Management:

Building stores without optimizing them for search engines wastes time and effort. Eventually, you’ll want top ranks on the SERPs to receive a digital footprint, and people will purchase from you.

Creating online stores without implementing search engine optimization wastes time and resources. Ultimately, the goal is to achieve top rankings on search engine results pages (SERPs) to establish a strong online presence and attract customers.

By setting up Magento Multistore, you’ll have a single management point for your SEO efforts. You can track the activities and make the required changes. You can even see how different stores are performing, and if something works for one store, you can easily implement that for your other store as well.

So, the benefits of multistore are many in terms of effort, monetary value, management, etc. Now let’s look at how you can easily set up Magento 2 Multistore.

How to Setup Magento 2 Multistore?

Below is the step-by-step process to build a Magento multistore with as many webstores as you like.

Just log in to the Magento 2 Admin, and follow the steps below to set up the multi stores:

Step 1: Choose a Compatible Hosting Service

Running multiple stores from a single dashboard is only possible if you have a hosting plan to sustain such heavy activity and simplify website management.

Ideally, your hosting service should offer the following:

  • Optimized Magento stack so that all your sites load fast.
  • Highly scalable solutions so that sudden traffic spikes don’t crash your stores.
  • Secure sites so that your stores are protected against malicious online activities.
  • Additional features such as CDN, automated backups, and 24/7 support.

Cloudways’ optimized managed Magento hosting provides all the features mentioned above to deliver the best-in-class experience to you.

All these will ensure that you have healthy stores that don’t face downtimes and have ironclad security. Only then will you have the resources to run multiple stores and offer a seamless shopping experience to your customers.

Deliver the Best Shopping Experience With Optimized Magento Hosting!

Our optimized tech stack offers Apache, Nginx, PHP-FPM, and MariaDB combined with top-notch security and high scalability for your stores so that your users always have a delightful experience.

Step 2: Create Root Categories

Creating a root category is optional, but you can assign and create additional categories if you choose.

To create a root category, follow the steps below:

1: Navigate to Catalog > Categories.

2: Click Add Root Category

3: In the Category Name field, enter a unique name to identify this category.

4: Make sure that Enable Category is set to Yes.

2 enable to yes

5: Click Save.

6: Repeat these steps if you want to create more root categories for your stores.

Step 3: Create Website

Once your root categories are set, it’s time to create websites.

To create websites, follow these steps:

1: Navigate to the Store > Settings > All Stores.

2: Click on Create Website and configure the following fields:

3 create website

  • Name: Insert a name for your new website.
  • Code: This code needs to be unique.
  • Sort Order (Optional): Insert the sort order for your website. Remember, the default is ‘0’.

4 save website

3: Click Save Web Site.

4: Repeat these steps to create as many websites as you like.

Step 4: Create Stores

After the sites are ready, it’s time to build your stores.

To create stores, follow these steps:

1: Navigate to Stores > Settings > All Stores.

2: Click on Create Store, then follow the below fields:

5 creating store

  • Web Site: Select the website name with which to associate this store.
  • Name: Enter a name to identify the store.
  • Code: Enter a unique code to identify the store.
  • Root Category: Click the name of the root category for this store.

6 store information

3: Click Save Store.

4: Repeat these steps to create as many stores as you like.

Step 5: Create Store Views

This is where you create store views.

To create a store view, follow the below steps:

1: Navigate to Stores > Settings > All Stores.

2: Click Create Store View and fill in the details:

7 creating store views

  • Store: Select the store name with which to associate this store view.
  • Name: Enter a name to identify this store view.
  • Code: Enter a unique name to identify this store view.
  • Status: Select Enabled.
  • Sort Order (optional): Set the position of the new store in the list.

8 save store view

3. Click Save Store View.

4. Repeat these steps to create as many store views as you like.

Step 6: Change the Website Base URL

In this step, you’ll need to change the base URL for each website in the Admin to access them using unique URLs.

Follow the below steps to configure the website URL:

1: Navigate to Stores > Settings > Configuration > General > Web.

2: From the upper left corner, select the Store View list at the top of the page, and click the name of one of your websites.

9 default config

3: Expand Base URLs. In the Base URLs section, clear Use Default.

4: Change the subdomain like “http://arabic.cloudways.com” URL if you have any in the Base URL and Base Link URL fields.

5: Repeat the previous step in the Base URLs (Secure) section.

10 arabic url

6: Click Save Config.

7: Repeat these steps for other websites.

Step 7: Add the Store Code to the Base URL

Adding the store codes can prevent you from creating separate directories for each store and simplifies the process.

To add the store code to the base URL, follow the below steps:

1: Navigate to Stores > Settings > Configuration > General > Web.

2: From the Store View list at the top of the page, click Default Config as shown below:

11 configurations

3: Expand URL Options and clear the Use system value checkbox next to Add Store Code to URLs.

4: From the Add Store Code to URLs list, click Yes.

10 add code to url

5: Click Save Config.

6: If prompted, flush the cache. (System > Cache Management).

Step 8: Change the Default Store View Base URL

This is important. Improper execution here may result in you losing access to the Admin.

To change the default store view base URL, follow the below steps:

1: Navigate to Stores > Settings > Configuration > General > Web.

2: From the Store View list at the top of the page, click Default Config.

12 default config

3: Expand Base URLs section. In the Base URLs section, clear Use system value.

4: Enter the http://magento.mg URL in the Base URL and Base Link URL fields.

5: Repeat the previous step in the Base URLs (Secure) section.

6: Click Save Config.

Step 9: Flush Magento Cache

The final step is to flush the cache. The process is super simple. Navigate to Systems > Cache Management.

12 cache management

Once done, click the “Flush Magento Cache” button and wait until the process is complete.

13 flush magento cache

That’s all. You are done.

Although your Magento multistore is all set up, there are some unfortunate instances where users may encounter errors. To ensure that you don’t experience unnecessary delays and stress, I’ve covered common issues you may face when setting up the store and their solutions below.

Multistore Efforts Work Best With Optimized Magento Hosting!

Cloudways Magento stack offers Apache, Nginx, PHP-FPM, and MariaDB combined with top-notch security and high scalability. That’s all you need to deliver a great shopping experience that brings in more conversions.

Common Issues You May Face When Setting up the Store

Now, let’s check out some common issues, along with their solutions, that can pop up in the process.

Getting the Forbidden Error 403 in the process

During the multi-store setup, you may face a 403 error forbidden when accessing the site. Forbidden indicates that you do not have permission to access the site, but this could be due to several reasons. To fix this, let’s understand a few things to check:

File Permissions

Check the file and directory permissions of your Magento 2 installation to ensure they are set up correctly. Typically, files have 664, and directories have 775 permissions. To check permissions, run the commands below:

find /path/to/your/magento2/ -type f -exec chmod 644 {} \;

find /path/to/your/magento2/ -type d -exec chmod 755 {} \;

.htaccess file

Ensure that the .htaccess file is correctly configured and present in the Magento 2 root directory. It should match the default file provided by Magento 2. Check if there are any custom rules or misconfigurations.

Store Configuration

Revisit the store configurations again in the Magento 2 admin to ensure the store code, Base URLs, and other settings are correct as per the multi-store setup.

URL Rewrite Rules

Double-check if the URL Web server Rewrites are enabled. navigate to Stores > Configuration > General > Web > Search Engine Optimization. Ensure “Use Web Server Rewrites” is set to “Yes.”

There could be multiple reasons for the forbidden 403 error; you may check here for full details.

Subdomain Not Showing Content

If your subdomains don’t show content, then you’ll need to revisit your backend to ensure everything is proper.

Solution?

See that you have the right new folders created and the domains are properly pointed to those folders.

Also, create a test.php file and then access it. That should resolve the issue for you.

Magento Multisite Extension Issues

Sometimes, the extensions may cause issues. With a multistore setup, you can choose to keep extensions operational on one store while disabling them on the others. This generally isn’t an issue unless you wrongly update the Magento version.

Cookie Issues to Increase Customer Session Time

Customers can face the challenge of session login time per store in a multistore setup. As long as the customers sign in to one store, it doesn’t automatically sign in to another, but this can be resolved by configuring the online session time.

So, for example, if a customer logs in to their account on your site, doesn’t log out and closes the browser, or just doesn’t browse through your site for a while and then revisits the site, he will still be logged in to their account only if the cookie lifetime hasn’t expired.

The solution is to set up the cookie settings in Magento Admin. Switch to the specific store and configure the cookie value for that store.

To do so, navigate to Stores > Configuration > General > Web > Default Cookie Settings > Cookie Lifetime.

14 default cookie settings

Issues Regarding Multi Stores With the Same Code

During the setup of multi-stores, if you have multiple websites and intend to use store codes in the URL for store views within each website, you might encounter issues resulting from misconfigurations.

For example, you have two stores, and they have their own domain (.be and .nl), and you want both domains in the English language as store code for URL /en/. Just like:

example.nl/en/

example.be/en/

The solution is to create a separate directory folder in the Magento root directory for each store code e.g. pub/en and pub/nl. And make these folders act as the document root for specific store views.

You can create these folders in the Magento “pub” directory, and here’s what the structure should look like:

/es/hair

/es/pets

/fr/hair

/fr/pets

In these folders, copy both .htaccess and index.php files from the magento/pub folder.

Issues with Allowing Customers to Log in to Multiple Stores with the Same Credentials

There may be times when all your stores serve different functions for the same cause. When that happens, your visitors would want to signin to all your sites with the same credentials. Forcing them to have individual accounts for each site will frustrate them and force them to leave.

To avoid this issue you can grant your customers access to multiple stores with the same login details. Here are the steps you should follow:

Stores > Settings > Configuration > Customers > Customer Configuration -> Account Sharing Options.

Change “Share Customer Accounts” to “Global.”

15 default global configurations

That’s all.

Advanced Tips For Magento Multi Store Setup

Setting up a Magento multistore is an easy feat with the steps mentioned above. Simply follow them, and you’ll achieve your purpose. However, there are several advanced tips that you may follow to get better work done.

Let’s have a look at some advanced tips that you should keep in mind when building your Magento multistore.

Separate Directories for Each Website

Ensure the domain name you wish to use points to the server. If you have multiple domains and you want to set up the store’s same codes, follow the guidelines below:

  • Create a subfolder with the desired name. e.g.,/jp/.
  • Copy index.php & .htaccess from root (!important copy both files).
  • Open index.php to clear everything inside it.
  • Change both Base URLs and Base URLs (Secure) Links, e.g., example.com/jp
  • Save. Clear Cache. Reindex.
  • Enjoy your new website inside a sub dir.

Shared Directories for Each Store (Using Pointer Domain)

For the Magento 2 multi-store setup, the URL structure is your preference. A shared domain with a different slug or path looks like this:

domain.com/store1

domain.com/store2

Follow the below guidelines for pointing the domain:

  • Create a server alias pointer domain for your new store. The pointer domain will be pointing at the primary domain of your Magento installation.
  • Edit index.php and add the following code:
<?php

$params = $_SERVER;

$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'yourcode.yourdomain.com';

$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

$app = $bootstrap->createApplication('Magento\Framework\App\Http');

$bootstrap->run($app);

?>

Save index.php to save your changes.

  • Edit .htaccess file in the document root of your Magento installation and enter the following code just above the line RewriteEngine On:
SetEnvIf Host .*[StoreCode].* MAGE_RUN_CODE=[StoreCode]

SetEnvIf Host .*[StoreCode].* MAGE_RUN_TYPE=website or store
  • Once you have successfully configured your pointer domain to work with Magento, you’re ready to develop the new store.

Use Shared Databases

To reduce overhead and complexity. You can use a single database for all your stores if they share the same products and customer data. This approach simplifies data synchronization.

Version Control

Use a version control system like Git to track changes in the codebase. Create separate branches for each store’s customizations, allowing you to easily manage and merge updates.

Cloudways allows a user to get updated code deployed on their live servers as soon as the changes in the remote repositories occur.

URL Configuration

For advanced multi-store configurations, set up custom URLs for each store or store view. Configure URL rewriting to ensure that SEO-friendly URLs work correctly for all stores.

Multi-Website Setup

For advanced multi-store configurations, you may need to set up multiple websites within a single Magento instance. Carefully manage website-level settings, including databases, design themes, and configuration scopes.

Conclusion

Having Magento multistore offers so many benefits. From easy management to cutting down on costs and resources, the upside is too big to ignore.

With this easy, step-by-step tutorial, I hope you can easily set up a multistore with as many stores as you like and manage them all from a single admin panel.

Just keep in mind that Improper execution can result in faulty setup. In such a case, there’ll be hassles of putting corrective measures in place.

To round up, if you are unsure about doing things yourself, it’s highly recommended that you get a Magento expert to get the job done for you!

Share your opinion in the comment section. COMMENT NOW

Share This Article

Abdur Rahman

Abdur Rahman is the Magento whizz at Cloudways. He is growth ambitious, and aims to learn & share information about Ecommerce & Magento Development through practice and experimentation. He loves to travel and explore new ideas whenever he finds time. Get in touch with him at [email protected]

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour

CYBER WEEK SAVINGS

  • 0

    Days

  • 0

    Hours

  • 0

    Mints

  • 0

    Sec

GET OFFER

For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now