Magento 2.0.18 is the final 2.0.x release. After March 2018, Magento 2.0.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

Multiple websites or stores

Introduction to multiple Magento stores and websites

One instance of the Magento software can enable you to start multiple websites or store views that use different:

  • Default languages
  • Domain names
  • Categories

This flexible solution enables one Magento codebase and Magento Admin to administer and display different stores.

You configure the websites, stores, and store views in the Magento Admin . You use the MAGE_RUN_TYPE and MAGE_RUN_CODE variables in virtual hosts to start the Magento application using these websites or store views.

A typical use of MAGE_RUN_TYPE and MAGE_RUN_CODE is to set up stores with different options in different domains. For example, you could have one set of categories and products on one domain and another domain that has categories and products for a different language.

Configure Magento websites and stores

This section discusses the minimum tasks required to use the MAGE_RUN_TYPE and MAGE_RUN_CODE variables.

We use the following terms:

  • Website is the top-level container for sites, shipping methods, payment methods, and so on. To create completely separate sites that do not share cart, shipping methods, and so on, you must create separate websites.

  • Store is contained by a website . In turn, a store contains at least one store view.

    Multiple stores can share cart, user sessions, payment gateways, and so on, but they have separate catalog structures.

    Store views change the way pages are presented, and are typically used to display a store with different layouts or languages.

Each website and each store view must have a unique identifier. This identifier is required to use MAGE_RUN_TYPE and MAGE_RUN_CODE as follows:

  • MAGE_RUN_TYPE can be either store or website

    • Use website to load a website in your storefront.
    • Use store to load any store view in your storefront.
  • MAGE_RUN_CODE is the unique website or store view code that corresponds to MAGE_RUN_TYPE

Following is a summary of the tasks you must perform. More details are provided in the sections that follow.

  1. Define websites, stores, and store views in the Magento Admin.
  2. Create one virtual host per Magento website or store view.
  3. Pass the values of MAGE_RUN_TYPE and MAGE_RUN_CODE to the web server.