How to set up Magento 2 with multiple stores & domains

Learn the benefits of Magento multi-store and steps to create stores, configure store views, create custom URLs, and add the store code to the base URL.
Get fast, reliable hosting for WordPress
Power your site with the industry’s fastest, most optimized WordPress hosting

Introduction to setting up Magento 2 with multiple stores & domains
Let’s explore how Magento multi-store helps your online business grow.What is Magento 2?
Magento 2 is an open source platform that provides tools such as customer, catalog, and inventory management required to build and run an online store. Whether you’re a small brand selling locally or an enterprise selling globally, Magento can support your online operations.Benefits of setting up Magento 2 with multiple stores & domains
Here’s how Magento 2 multi-store helps your online business.1. Multiplies your reach without increasing costs
With Magento multi-store you don’t need to build a new store from scratch. You can sell on multiple sites using the same hosting, theme, and extensions.2. Enables you to diversify your business model
Magento multi-store makes it easy to diversify your business model using existing assets and resources. For example, if you’re selling B2C, you can set up a B2B website that offers wholesale pricing easily.3. Helps you expand into new markets efficiently
As you expand your business, multiple storefronts allow you to create localized shopping experiences. You can use websites to offer separate delivery and payment methods for each market or add store views to present content in different languages.4. Empowers you to offer market-based products and pricing
Magento lets you use separate catalogs with dedicated inventories and pricing for each website. That simplifies managing logistics and payments for new markets.5. Simplifies data-driven decisions
With everything running from the same platform, you have a unified data source for essential business decisions. You can track sales, manage products, and plan inventory for all sites and stores without leaving the admin panel.Setting up Magento 2 with multiple stores & domains
Follow these steps to set up Magento with multiple stores and websites.1. Choose a managed Magento 2 hosting plan
Choose a managed Magento hosting plan that gives you the resources to run multiple websites. Some important factors to look for in a Magento hosting provider include:- Speed and website performance features.
- Storage and bandwidth allocation.
- Scalability.
- Value-added services.
- Support options.
2. Configuring multiple stores in the admin panel


- Name: Assign a name to your website.
- Code: Enter a unique code for your website.
- Sort Order: Enter a number to set the display chronology.

- Web Site: Use the dropdown to associate a website with your new store.
- Name: Enter the store name.
- Code: Set a unique identifier for the store.
- Root Category: Select a root category for the store.
3. Assigning store views to each store


- Store: Choose a store from the dropdown to associate with this store view.
- Name: Enter the store view name.
- Code: Enter a unique identifier for the store view.
- Status: Set to Enabled.
- Sort Order: Assign a number to organize the chronology of multiple store views.
4. Creating custom URLs for each store
You need to update the base URL for each website so you can access the website using a subdomain.

5. Add the store code to the website base URL
Adding the store code at the end of the website base URL makes it easier to set up and manage multiple stores in two ways:- You don’t need to create separate index.php and .htaccess files for each store.
- Your Magento store’s index.php and .htaccess files remain in sync with the codebase when you update Magento in the future.

6. Configure your web server
To access your new website in a browser, you need to update your web server’s configuration file to pass the values of the $MAGE_RUN_TYPE and $MAGE_RUN_CODE variables to the web server. The steps to do that will vary depending on whether you’re using Apache or Nginx as your web server. Adobe has detailed guides for Apache and Nginx that show you exactly how to set it up. After that, go to your DNS management account and point your subdomain(s) to your Magento server. You’ll be able to access your new Magento multi-store sites once the DNS information propagates. Here’s how our new Magento website looks with the store view switcher menu:
Bottom line
We’ve explained the benefits of setting up Magento multi-store and showed you the exact steps you need to follow to set it up. Remember that multiple websites and stores, even on the same Magento installation, need more resources than a single website. That’s why choosing a reliable hosting provider that offers auto scaling features and lets you upgrade your hosting plan easily is essential. Managed Magento hosting with Nexcess gives you all that and more. All plans include 24hrs of free autoscaling each month, an Nginx-based Cloud Accelerator, and an integrated global CDN, so your Magento store is prepared for viral moments at all times. Browse our Magento hosting plans to get started today.Additional resources
What is managed WordPress hosting? →
Get details and decide if managed WordPress hosting is right for you.
Must-have web development plugins to create WordPress websites at scale →
Explore the best web development plugins to enhance functionality, improve performance, and streamline your WordPress site.
A complete guide to WordPress shortcodes →
Shortcodes make life easier. Learn how to get started!