пятница, 23 апреля 2021 г.

Magento 2 Multistore one domain

domain.com/store1

domain.com/store2

  1. Admin Panel: Stores/Settings/Stores (table store for checking code for MAGE_RUN_CODE)
    website: base, store: store1_code, store view: store1
    website: base, store: store2_code, store view: store2
  2. Admin Panel: Configuration/Web/URL Options/Add Store Code to Urls - Yes
  3. NGINX: 

    .php

        fastcgi_param  MAGE_RUN_TYPE    $MAGE_RUN_TYPE;

        fastcgi_param  MAGE_RUN_CODE    $MAGE_RUN_CODE;

    http

    map $request_uri $MAGE_RUN_CODE {

        ~^/store1 store1;

        ~^/store2 store2;

    }

    server
        set $MAGE_RUN_TYPE store;