The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

How to Setup Multi Store in Magento 2

Setting up Magento Multi Store is one of the variable functionalities Magento 2 brings to store owners. This feature allows you to create stores as many as you need only in a single configuration. All stores share the same domain, be set up as subdomains of the same domain, or have an entirely different domain, yet possibly share the same backend for easier administration.

Learn more: Setup automatic change store view using Magento 2 Store Switcher

Benefits of creating multiple stores in Magento 2

With different goals in mind, such as expanding your business or operating your business in different locations, you may want to create multiple stores. But multiple stores can bring you more amazing outcomes than that, such as:

  • Save money by using the same payment gateways
  • Get uniform support for all of your built stores from third-party extensions
  • Maintain a standard customer database that may be used across all stores.
  • Share the same content of Terms & conditions, privacy policy, and other materials for the pages.

Therefore, you can follow the instructions below to apply these awesome benefits to your store. Additionally, you can add multiple websites for each store you want to configure.

Magento Multisite vs. Magento Multistore: Comparison Chart

Aspect Magento Multisite Magento Multistore
Definition Multiple, separate websites from a single Magento installation Multiple stores under a single website or domain
Example Separate websites for the US, UK, and Canada English and French stores on the same domain
Main purpose Distinct websites for different brands, regions, or segments Different store views or segments under one main website
Domains Different domains or subdomains Same domain with unique store views or subdirectories
Product Catalogs Separate product catalogs Shared product catalogs
Customer Databases Separate customer databases Shared customer databases
Design & Layout Independent design and layout for each website Different layouts possible, but generally shared design elements
Admin Panel Separate admin panels Centralized admin panel

7 Steps to Setup Multiple Stores in Magento 2

Step 1: Create Websites

Go to Store > Settings > All Stores. Then, click on Create Website, and fill out the following fields:

Create a new 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’.

Website's fields

Step 2: Create Stores

In this step, you will fill in the required information about the new store in the ‘Store Information’ section.

  • On the Admin Panel, Stores > Settings > All Stores.
  • Click on Create Store, then follow the below
    • Select the Website that is the parent of the new store. If there is only one website, use the default “Main Website”.
    • Fill in the Name for the new store, just for internal reference.
    • In the Root Category field, you will set the root category for the main menu of the new store. The created root categories are shown in the dropdown list, select one for the store.

How to Setup Multiple Stores Magento 2 Information

  • Save Store to complete.

How to Setup Multiple Stores New Stores

Step 3: Add Store Views

After adding the new store, you will now need to create the store view:

  • Click on Create Store View, you can:
    • Assign the Store to the new store you’ve just created.
    • Set the Name for the store view.
    • Type the Code for the store view with lower characters.
    • Choose “Enabled” for the Status.
    • Specify the Sort Order that is the position of the new store in the list.
  • Save Store View to save all settings.

How to Setup Multiple Stores Magento 2 View Information

Step 4: Setup the Website’s Base URL

In this step, we will configure the Store URL.

  • On the Admin Panel, go to Stores > Settings > Configuration.
  • On the left panel, under General, select Web.
  • In the upper-left corner, choose Store View to check the new store you added.
  • Hit OK to verify the scope switching.

How to Setup Multiple Stores Magento 2 Choose New Store View

  • Open the Base URLs section,
    • Clear the Use Website checkbox, that is next to the Base URL field.
    • Change the Base URL for the store.

How to Setup Multiple Stores Base URLs

  • Open the Secure Base URLs section below to set the store’s secure URL if needed.
  • Save Config to complete.

Step 5: Add the store code to the base URL

With Magento, admins can add a store code to the website’s base URL, simplifying the multistore setup process. Thanks to this feature, store owners can cut down the step of creating directories on the file system for storing index.php and .htaccess.

Additionally, this option helps prevent index.php and .htaccess from falling out of sync with the Magento source in future upgrades.

  • Go to the admin panel and navigate to Stores > Settings > Configuration.
  • Under the General section, choose Web.
  • From the list at the top, select Default Config.
  • Then you will see the first section - Url Options, fill it out.

URL

Step 6: Change the base URL in the default store view

  • Navigate to Stores > Settings > Configuration. Under the General section, choose Web.
  • From the list at the top, select Default Config.
  • Then, expand the Base URLs section and insert your website’s base URL.
  • Ex: https://www.example.com/
  • Finally, click the Save Config button.

Note: You might be confused that your access to the admin panel is no longer active after this step. Don’t panic, it will be accessible again soon after you finish the next step - configuring virtual hosts.

Step 7: Server-side configurations

This is the final step to complete setting up Magento 2 multistore. At this point, store admins need to change a few things to the web server configuration. In detail:

  • For each new website, create a new virtual host.
  • Pass the MAGE_RUN_TYPE and MAGE_RUN_CODE values to the new configurations.
  • Configure static routes to the host (Optional)

Depending on the type of server you run, the process of creating a new virtual host for your new websites may differ.

Ex: With Apache 2.4 and above servers, the process requires modifying your /etc/httpd/conf/httpd.conf likethis:

<VirtualHost *:80>
   ServerName          mysite.mg
   DocumentRoot        /var/www/html/magento2/pub/
</VirtualHost>

<VirtualHost *:80>
   ServerName          french.mysite.mg
   DocumentRoot        /var/www/html/magento2/pub/
   SetEnv MAGE_RUN_CODE "french"
   SetEnv MAGE_RUN_TYPE "website"
</VirtualHost>

<VirtualHost *:80>
   ServerName          german.mysite.mg
   DocumentRoot        /var/www/html/magento2/pub/
   SetEnv MAGE_RUN_CODE "german"
   SetEnv MAGE_RUN_TYPE "website"
</VirtualHost>
  • ServerName: your new website’s domain.
  • DocumentRoot: where Magento is enabled. It’s highly recommended to set DocumentRoot to Magento /pub/ directory for better security.
  • SetEnv MAGE_RUN_TYPE: set to website or store, based on the ServerName: a new website/ a new store scope.
  • SetEnv MAGE_RUN_CODE: configure to the unique website/ store view code corresponding to MAGE_RUN_TYPE.

After that, restart the web server by running:

  • CentOS: service httpd restart
  • Ubuntu: service apache2 restart

Configure static routes to the host (Optional)

If you don’t have DNS configured for your store’s URLs, create static routes in the hosts file, following this format:

<ip address> <new website>

Note: If you want a separate checkout procedure, configure your Magento domains to use different IP addresses. That’s it! Your multi-stores are now ready.

Creating Magento Multistore: Challenges and Solutions

1. Complexity in Managing Multiple Stores

  • Challenge: Managing multiple stores within a single Magento installation can be complicated, especially when dealing with product catalogs, pricing, and inventory across different stores.
  • Solution: Take advantage of Magento’s powerful multistore management features. Use the shared catalog and inventory capabilities to simplify management. Implement a centralized admin panel to oversee all stores efficiently.

2. Performance Issues

  • Challenge: Running multiple stores can lead to performance bottlenecks, affecting load times and overall user experience.

  • Solution: Optimize server performance by using a powerful hosting solution tailored for Magento. Implement caching strategies, optimize databases, and use Content Delivery Networks (CDNs) to enhance load times.

3. SEO Management

  • Challenge: Managing SEO for multiple stores can be tricky, particularly when dealing with duplicate content and ensuring each store is optimized for its target audience.
  • Solution: Use Magento’s built-in SEO tools to customize meta tags, URLs, and sitemaps for each store. Implement canonical tags to avoid duplicating content and regularly monitor SEO performance using tools like Google Analytics and Search Console.

4. Content Duplication

  • Challenge: Content across stores might get duplicated, impacting SEO.
  • Solution: Implement canonical tags to guide search engines toward the preferred version of a page. Ensure your robots.txt file and meta tags are correctly configured for each store view.

5. Design Customization

  • Challenge: Creating and maintaining individual themes for each store can be time-consuming, especially when aiming for distinct brand identities.

  • Solution: Optimize theme management with a responsive, customizable framework. Reuse design elements across stores. Use Magento’s theme fallback system to inherit designs from a parent theme and customize each store as needed.

FAQs

1. Can I use different themes for each store in Magento 2?

Yes, in Magento 2, you can use different themes for each store. This feature allows you to customize the appearance of each store independently to suit its branding or target audience. You can assign specific themes to individual stores or store views within your Magento 2 installation. This flexibility enables you to create unique and tailored experiences for customers visiting different stores under the same Magento 2 instance.

2. Is it possible to manage different settings for each store within Magento 2?

In Magento 2, you can handle separate settings for each store. You can adjust Magento settings and set different “website base URLs” for each store. This allows you to customize settings such as prices, products, and themes according to your needs.

3. Can you have several store views with different base URLs in Magento?

In Magento, you can make various store views with separate base URLs. This lets you customize the web server setup for each store view, guaranteeing each store has its distinct online identity.

4. How can I configure Magento for multiple storefronts?

To set up Magento for multiple stores, you can give each store its own web address. Make sure each new website has a designated host. Also, give each store a unique code to tell them apart. You can create as many stores as you want, each with multiple web addresses for better organization.

The bottom line

The need to set up Magento multi store has been increasing due to different business goals, and also because of the amazing benefits it can bring to online stores. If you also want to do it, start following this tutorial. Leave comments below to share your ideas and tell us about your concerns if any. See you in later posts!

Related Post

Image Description
With over a decade of experience crafting innovative tech solutions for ecommerce businesses built on Magento, Jacker is the mastermind behind our secure and well-functioned extensions. With his expertise in building user-friendly interfaces and robust back-end systems, Mageplaza was able to deliver exceptional Magento solutions and services for over 122K+ customers around the world.

Looking for Magento Development Company?

8+ years of experiences in e-commerce & Magento has prepared us for any challenges, so that we can lead you to your success.

Get free consultant
development service
x

    Explore Our Products:

    People also searched for

    Subscribe

    Stay in the know

    Get special offers on the latest news from Mageplaza.

    Earn $10 in reward now!

    Earn $10 in reward now!

    comment
    iphone
    go up