Magento2.1: How to create multiple websites with different domainsMagento2: How to create multiple storefrontsSharing Sessions Between Stores with Different DomainsMultiple stores, dynamic domains problemHow to create Multiple Store with different domain in MagentoMagento 1.9 multiple websites on different domainsHow to merge different magento installed websites to one installation as multiple storeSingle webstore with multiple fullfilment locationsMulti store with different domains, cookie store is causing problemHow to switch the main domain on multi-website Magento 2.1.0 installation?How to configure Magento 2 multiple websites on AWS EC2

Setting MAC field to all-zero to indicate unencrypted data

What would be the ideal melee weapon made of "Phase Metal"?

What is this welding tool I found in my attic?

Novel where a group of scientists in a spaceship encounter various aliens

Keep milk (or milk alternative) for a day without a fridge

If the railway suggests a 5-min connection window for changing trains in the Netherlands, does that mean it's definitely doable?

Flatten array with OPENJSON: OPENJSON on a value that may not be an array? [ [1] ], vs [1]

Was I subtly told to resign?

Should disabled buttons give feedback when clicked?

How can one write good dialogue in a story without sounding wooden?

Referring to different instances of the same character in time travel

Shortest distance around a pyramid?

Why isn't there research to build a standard lunar, or Martian mobility platform?

Why do players in the past play much longer tournaments than today's top players?

Did any of the founding fathers anticipate Lysander Spooner's criticism of the constitution?

CentOS 7 -> find: missing Argument for "-exec"

Is there a word for a message that is intended to be intercepted by an adversary?

What explains 9 speed cassettes price differences?

How is angular momentum conserved for the orbiting body if the centripetal force disappears?

Why were Er and Onan punished if they were under 20?

What is the best way to stacked subscripts for a matrix?

references on the empirical study on the practice of OR

How can I get a player to accept that they should stop trying to pull stunts without thinking them through first?

How were Martello towers supposed to work?



Magento2.1: How to create multiple websites with different domains


Magento2: How to create multiple storefrontsSharing Sessions Between Stores with Different DomainsMultiple stores, dynamic domains problemHow to create Multiple Store with different domain in MagentoMagento 1.9 multiple websites on different domainsHow to merge different magento installed websites to one installation as multiple storeSingle webstore with multiple fullfilment locationsMulti store with different domains, cookie store is causing problemHow to switch the main domain on multi-website Magento 2.1.0 installation?How to configure Magento 2 multiple websites on AWS EC2






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I deployed Magento 2.1 on console.google
Is there anybody who succeded to deploy multiple websites with different domains?
Magento2: How to create multiple storefronts
does not works for Magento 2.1



I am sure many people suffer the same issue?



There is not any answer to similar question for Magento 2.1 on link
How to setup another domain/website on the same Magento 2.1.0 installation? (updated)










share|improve this question






























    0















    I deployed Magento 2.1 on console.google
    Is there anybody who succeded to deploy multiple websites with different domains?
    Magento2: How to create multiple storefronts
    does not works for Magento 2.1



    I am sure many people suffer the same issue?



    There is not any answer to similar question for Magento 2.1 on link
    How to setup another domain/website on the same Magento 2.1.0 installation? (updated)










    share|improve this question


























      0












      0








      0








      I deployed Magento 2.1 on console.google
      Is there anybody who succeded to deploy multiple websites with different domains?
      Magento2: How to create multiple storefronts
      does not works for Magento 2.1



      I am sure many people suffer the same issue?



      There is not any answer to similar question for Magento 2.1 on link
      How to setup another domain/website on the same Magento 2.1.0 installation? (updated)










      share|improve this question
















      I deployed Magento 2.1 on console.google
      Is there anybody who succeded to deploy multiple websites with different domains?
      Magento2: How to create multiple storefronts
      does not works for Magento 2.1



      I am sure many people suffer the same issue?



      There is not any answer to similar question for Magento 2.1 on link
      How to setup another domain/website on the same Magento 2.1.0 installation? (updated)







      magento2 multistore multidomain cloud






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '17 at 12:55









      Community

      1




      1










      asked Oct 6 '16 at 12:33









      CengizCokayCengizCokay

      12 bronze badges




      12 bronze badges




















          2 Answers
          2






          active

          oldest

          votes


















          1














          I got it:



          In the config for your stores, just enter the URLs as they are, not the install URL. Then, on the alternative domain (otherstore.com), use the default htaccess (when it is in root, otherwise add rewrite in htaccess)and put just this inside the index.php:



          require __DIR__ . '/app/bootstrap.php';
          $params = $_SERVER;
          $params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = 'websitecode';
          $params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = 'website';
          $bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
          /** @var MagentoFrameworkAppHttp $app */
          $app = $bootstrap->createApplication('MagentoFrameworkAppHttp');
          $bootstrap->run($app);


          The following is key though, i did not get it to work otherwise, au contraire Magento 1 where we had lots of stores without this. Go to your other store root with ssh and enter this:



          ln -s /path/to/your/install/public_html/m2/app/ app 
          ln -s /path/to/your/install/public_html/m2/lib/ lib
          ln -s /path/to/your/install/public_html/m2/pub/ pub
          ln -s /path/to/your/install/public_html/m2/var/ var


          After we added the latter, everything seems to work fine, so far.



          Good luck!






          share|improve this answer






























            0














            You can create multiple websites or store views in Magento 2 admin panel and map unique domains to each of them.



            Step 1: Point all domains to pub in Magento's root directory



            Step 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.



            Step 3: Set store or website for each domain as environment variable in .htaccess of pub directory or in the webserver configuration.




            • Example with the websites as given in the question:



              SetEnv MAGE_RUN_TYPE website
              SetEnvIf Host abc.com MAGE_RUN_CODE=domain1
              SetEnvIf Host xyz.com MAGE_RUN_CODE=domain2



            • Example with store views instead of websites



              SetEnv MAGE_RUN_TYPE store
              SetEnvIf Host abc.com MAGE_RUN_CODE=store_code_1
              SetEnvIf Host xyz.com MAGE_RUN_CODE=store_code_2


              These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace abc.com with ^abc.com$



            Step 4: Clear cache and access your domains.






            share|improve this answer

























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "479"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f139687%2fmagento2-1-how-to-create-multiple-websites-with-different-domains%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              I got it:



              In the config for your stores, just enter the URLs as they are, not the install URL. Then, on the alternative domain (otherstore.com), use the default htaccess (when it is in root, otherwise add rewrite in htaccess)and put just this inside the index.php:



              require __DIR__ . '/app/bootstrap.php';
              $params = $_SERVER;
              $params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = 'websitecode';
              $params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = 'website';
              $bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
              /** @var MagentoFrameworkAppHttp $app */
              $app = $bootstrap->createApplication('MagentoFrameworkAppHttp');
              $bootstrap->run($app);


              The following is key though, i did not get it to work otherwise, au contraire Magento 1 where we had lots of stores without this. Go to your other store root with ssh and enter this:



              ln -s /path/to/your/install/public_html/m2/app/ app 
              ln -s /path/to/your/install/public_html/m2/lib/ lib
              ln -s /path/to/your/install/public_html/m2/pub/ pub
              ln -s /path/to/your/install/public_html/m2/var/ var


              After we added the latter, everything seems to work fine, so far.



              Good luck!






              share|improve this answer



























                1














                I got it:



                In the config for your stores, just enter the URLs as they are, not the install URL. Then, on the alternative domain (otherstore.com), use the default htaccess (when it is in root, otherwise add rewrite in htaccess)and put just this inside the index.php:



                require __DIR__ . '/app/bootstrap.php';
                $params = $_SERVER;
                $params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = 'websitecode';
                $params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = 'website';
                $bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
                /** @var MagentoFrameworkAppHttp $app */
                $app = $bootstrap->createApplication('MagentoFrameworkAppHttp');
                $bootstrap->run($app);


                The following is key though, i did not get it to work otherwise, au contraire Magento 1 where we had lots of stores without this. Go to your other store root with ssh and enter this:



                ln -s /path/to/your/install/public_html/m2/app/ app 
                ln -s /path/to/your/install/public_html/m2/lib/ lib
                ln -s /path/to/your/install/public_html/m2/pub/ pub
                ln -s /path/to/your/install/public_html/m2/var/ var


                After we added the latter, everything seems to work fine, so far.



                Good luck!






                share|improve this answer

























                  1












                  1








                  1







                  I got it:



                  In the config for your stores, just enter the URLs as they are, not the install URL. Then, on the alternative domain (otherstore.com), use the default htaccess (when it is in root, otherwise add rewrite in htaccess)and put just this inside the index.php:



                  require __DIR__ . '/app/bootstrap.php';
                  $params = $_SERVER;
                  $params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = 'websitecode';
                  $params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = 'website';
                  $bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
                  /** @var MagentoFrameworkAppHttp $app */
                  $app = $bootstrap->createApplication('MagentoFrameworkAppHttp');
                  $bootstrap->run($app);


                  The following is key though, i did not get it to work otherwise, au contraire Magento 1 where we had lots of stores without this. Go to your other store root with ssh and enter this:



                  ln -s /path/to/your/install/public_html/m2/app/ app 
                  ln -s /path/to/your/install/public_html/m2/lib/ lib
                  ln -s /path/to/your/install/public_html/m2/pub/ pub
                  ln -s /path/to/your/install/public_html/m2/var/ var


                  After we added the latter, everything seems to work fine, so far.



                  Good luck!






                  share|improve this answer













                  I got it:



                  In the config for your stores, just enter the URLs as they are, not the install URL. Then, on the alternative domain (otherstore.com), use the default htaccess (when it is in root, otherwise add rewrite in htaccess)and put just this inside the index.php:



                  require __DIR__ . '/app/bootstrap.php';
                  $params = $_SERVER;
                  $params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = 'websitecode';
                  $params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = 'website';
                  $bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
                  /** @var MagentoFrameworkAppHttp $app */
                  $app = $bootstrap->createApplication('MagentoFrameworkAppHttp');
                  $bootstrap->run($app);


                  The following is key though, i did not get it to work otherwise, au contraire Magento 1 where we had lots of stores without this. Go to your other store root with ssh and enter this:



                  ln -s /path/to/your/install/public_html/m2/app/ app 
                  ln -s /path/to/your/install/public_html/m2/lib/ lib
                  ln -s /path/to/your/install/public_html/m2/pub/ pub
                  ln -s /path/to/your/install/public_html/m2/var/ var


                  After we added the latter, everything seems to work fine, so far.



                  Good luck!







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 17 '17 at 14:40









                  Kim K.Kim K.

                  337 bronze badges




                  337 bronze badges























                      0














                      You can create multiple websites or store views in Magento 2 admin panel and map unique domains to each of them.



                      Step 1: Point all domains to pub in Magento's root directory



                      Step 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.



                      Step 3: Set store or website for each domain as environment variable in .htaccess of pub directory or in the webserver configuration.




                      • Example with the websites as given in the question:



                        SetEnv MAGE_RUN_TYPE website
                        SetEnvIf Host abc.com MAGE_RUN_CODE=domain1
                        SetEnvIf Host xyz.com MAGE_RUN_CODE=domain2



                      • Example with store views instead of websites



                        SetEnv MAGE_RUN_TYPE store
                        SetEnvIf Host abc.com MAGE_RUN_CODE=store_code_1
                        SetEnvIf Host xyz.com MAGE_RUN_CODE=store_code_2


                        These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace abc.com with ^abc.com$



                      Step 4: Clear cache and access your domains.






                      share|improve this answer



























                        0














                        You can create multiple websites or store views in Magento 2 admin panel and map unique domains to each of them.



                        Step 1: Point all domains to pub in Magento's root directory



                        Step 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.



                        Step 3: Set store or website for each domain as environment variable in .htaccess of pub directory or in the webserver configuration.




                        • Example with the websites as given in the question:



                          SetEnv MAGE_RUN_TYPE website
                          SetEnvIf Host abc.com MAGE_RUN_CODE=domain1
                          SetEnvIf Host xyz.com MAGE_RUN_CODE=domain2



                        • Example with store views instead of websites



                          SetEnv MAGE_RUN_TYPE store
                          SetEnvIf Host abc.com MAGE_RUN_CODE=store_code_1
                          SetEnvIf Host xyz.com MAGE_RUN_CODE=store_code_2


                          These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace abc.com with ^abc.com$



                        Step 4: Clear cache and access your domains.






                        share|improve this answer

























                          0












                          0








                          0







                          You can create multiple websites or store views in Magento 2 admin panel and map unique domains to each of them.



                          Step 1: Point all domains to pub in Magento's root directory



                          Step 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.



                          Step 3: Set store or website for each domain as environment variable in .htaccess of pub directory or in the webserver configuration.




                          • Example with the websites as given in the question:



                            SetEnv MAGE_RUN_TYPE website
                            SetEnvIf Host abc.com MAGE_RUN_CODE=domain1
                            SetEnvIf Host xyz.com MAGE_RUN_CODE=domain2



                          • Example with store views instead of websites



                            SetEnv MAGE_RUN_TYPE store
                            SetEnvIf Host abc.com MAGE_RUN_CODE=store_code_1
                            SetEnvIf Host xyz.com MAGE_RUN_CODE=store_code_2


                            These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace abc.com with ^abc.com$



                          Step 4: Clear cache and access your domains.






                          share|improve this answer













                          You can create multiple websites or store views in Magento 2 admin panel and map unique domains to each of them.



                          Step 1: Point all domains to pub in Magento's root directory



                          Step 2: Configure domain names as base URLs for each website in System Configuration in Magento admin panel.



                          Step 3: Set store or website for each domain as environment variable in .htaccess of pub directory or in the webserver configuration.




                          • Example with the websites as given in the question:



                            SetEnv MAGE_RUN_TYPE website
                            SetEnvIf Host abc.com MAGE_RUN_CODE=domain1
                            SetEnvIf Host xyz.com MAGE_RUN_CODE=domain2



                          • Example with store views instead of websites



                            SetEnv MAGE_RUN_TYPE store
                            SetEnvIf Host abc.com MAGE_RUN_CODE=store_code_1
                            SetEnvIf Host xyz.com MAGE_RUN_CODE=store_code_2


                            These configurations check if the domain contains "abc.com" or "xyz.com", which I find useful to also match subdomains or test systems like abc.com.testserver.com or test.abc.com, using the same .htaccess file. If you want exact matching, replace abc.com with ^abc.com$



                          Step 4: Clear cache and access your domains.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 3 at 21:44









                          Aman SrivastavaAman Srivastava

                          9676 silver badges15 bronze badges




                          9676 silver badges15 bronze badges



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f139687%2fmagento2-1-how-to-create-multiple-websites-with-different-domains%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                              Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                              Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form