How to set the webroot in Magento 2?Why Magento 2 have 2 possible root folder?Magento 2 Upgrade 404 Error (document root set to PUB folder)Where are the javascript files from Magento 2.1.1?How to Run Magento 2 using pub/index.php fileMagento 2 - How to detect if a script is in the pub directoryWhere is the data related to PHP version stored in Magento?Magento 2 + Nginx: Multiple websites homepages work but every other URL is 404Physical location of robots.txt file in Magento 2.2Magento2 - Run Magento multistore from pub directoryDifference between root index.php and pub directory index.php in Magento2?

Don't understand notation of morphisms in Monoid definition

Is being an extrovert a necessary condition to be a manager?

How to draw with Tikz a chord parallel to AC that passes through a point?

Why are logically related bit fields in MCU registers often in separate locations

Good examples of "two is easy, three is hard" in computational sciences

Why is there no current between two capacitors connected in series?

Circuit construction for execution of conditional statements using least significant bit

Parse a C++14 integer literal

Is there a way to generate a mapping graph like this?

pwaS eht tirsf dna tasl setterl fo hace dorw

Department head said that group project may be rejected. How to mitigate?

Removing Doubles Destroy Topology

How can I use 400 ASA film in a Leica IIIf, which does not have options higher than 100?

Which one of these Isp's for the Dawn spacecraft is wrong?

Mikrokosmos, BB 105, Vol. 1: No. 17 Contrary Motion (1) - Can't understand the structure

Is there a word for pant sleeves?

Existence of a model of ZFC in which the natural numbers are really the natural numbers

Filter a file list against an integer array?

Do most Taxis give Receipts in London?

Will this series of events work to drown the Tarrasque?

If you attack a Tarrasque while swallowed, what AC do you need to beat to hit it?

Separate the element after every 2nd ',' and push into next row in bash

Warped chessboard

How can sister protect herself from impulse purchases with a credit card?



How to set the webroot in Magento 2?


Why Magento 2 have 2 possible root folder?Magento 2 Upgrade 404 Error (document root set to PUB folder)Where are the javascript files from Magento 2.1.1?How to Run Magento 2 using pub/index.php fileMagento 2 - How to detect if a script is in the pub directoryWhere is the data related to PHP version stored in Magento?Magento 2 + Nginx: Multiple websites homepages work but every other URL is 404Physical location of robots.txt file in Magento 2.2Magento2 - Run Magento multistore from pub directoryDifference between root index.php and pub directory index.php in Magento2?






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








0















I'm learning Magento 2 and can see that Magento has two index.php files. One is in the root folder and another one is in Pub folder. While reading many of the posts regarding webroot of Magento, I can see that we have to set the webroot to Pub folder for security.



Currently, I have installed the Magento in Xampp.



Can anyone please tell me how to set the webroot to Pub in Magento 2?










share|improve this question




























    0















    I'm learning Magento 2 and can see that Magento has two index.php files. One is in the root folder and another one is in Pub folder. While reading many of the posts regarding webroot of Magento, I can see that we have to set the webroot to Pub folder for security.



    Currently, I have installed the Magento in Xampp.



    Can anyone please tell me how to set the webroot to Pub in Magento 2?










    share|improve this question
























      0












      0








      0








      I'm learning Magento 2 and can see that Magento has two index.php files. One is in the root folder and another one is in Pub folder. While reading many of the posts regarding webroot of Magento, I can see that we have to set the webroot to Pub folder for security.



      Currently, I have installed the Magento in Xampp.



      Can anyone please tell me how to set the webroot to Pub in Magento 2?










      share|improve this question














      I'm learning Magento 2 and can see that Magento has two index.php files. One is in the root folder and another one is in Pub folder. While reading many of the posts regarding webroot of Magento, I can see that we have to set the webroot to Pub folder for security.



      Currently, I have installed the Magento in Xampp.



      Can anyone please tell me how to set the webroot to Pub in Magento 2?







      magento2 webroot






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked May 14 at 12:21









      SivaSiva

      460213




      460213




















          2 Answers
          2






          active

          oldest

          votes


















          2














          You can achieve this by updating your virtual host file, you need to change DocumentRoot DocumentRoot /var/www/html/magento2ce/pub:



          Example code:



          <VirtualHost *:80>

          ServerAdmin webmaster@localhost
          DocumentRoot /var/www/html/magento2ce/pub

          ErrorLog $APACHE_LOG_DIR/error.log
          CustomLog $APACHE_LOG_DIR/access.log combined

          <Directory "/var/www/html">
          AllowOverride all
          </Directory>

          </VirtualHost>


          For more information refer magento 2 devdocs



          https://devdocs.magento.com/guides/v2.3/install-gde/tutorials/change-docroot-to-pub.html






          share|improve this answer






























            2














            To set webroot to pub you will have to tell Magento where the pub folder actually is with something like this



            #File: pub/index.php
            $params = $_SERVER;
            $params[Mage::PARAM_APP_URIS][Mage_Core_Model_Dir::PUB] = '';
            $entryPoint = new Mage_Core_Model_EntryPoint_Http(new Mage_Core_Model_Config_Primary(BP, $params));


            You can also refer to https://alanstorm.com/magento-2-the-pub-folder/. But be ready to face some problems. You can find some of the problems you will face here https://github.com/magento/magento2/issues/15092






            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%2f274547%2fhow-to-set-the-webroot-in-magento-2%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









              2














              You can achieve this by updating your virtual host file, you need to change DocumentRoot DocumentRoot /var/www/html/magento2ce/pub:



              Example code:



              <VirtualHost *:80>

              ServerAdmin webmaster@localhost
              DocumentRoot /var/www/html/magento2ce/pub

              ErrorLog $APACHE_LOG_DIR/error.log
              CustomLog $APACHE_LOG_DIR/access.log combined

              <Directory "/var/www/html">
              AllowOverride all
              </Directory>

              </VirtualHost>


              For more information refer magento 2 devdocs



              https://devdocs.magento.com/guides/v2.3/install-gde/tutorials/change-docroot-to-pub.html






              share|improve this answer



























                2














                You can achieve this by updating your virtual host file, you need to change DocumentRoot DocumentRoot /var/www/html/magento2ce/pub:



                Example code:



                <VirtualHost *:80>

                ServerAdmin webmaster@localhost
                DocumentRoot /var/www/html/magento2ce/pub

                ErrorLog $APACHE_LOG_DIR/error.log
                CustomLog $APACHE_LOG_DIR/access.log combined

                <Directory "/var/www/html">
                AllowOverride all
                </Directory>

                </VirtualHost>


                For more information refer magento 2 devdocs



                https://devdocs.magento.com/guides/v2.3/install-gde/tutorials/change-docroot-to-pub.html






                share|improve this answer

























                  2












                  2








                  2







                  You can achieve this by updating your virtual host file, you need to change DocumentRoot DocumentRoot /var/www/html/magento2ce/pub:



                  Example code:



                  <VirtualHost *:80>

                  ServerAdmin webmaster@localhost
                  DocumentRoot /var/www/html/magento2ce/pub

                  ErrorLog $APACHE_LOG_DIR/error.log
                  CustomLog $APACHE_LOG_DIR/access.log combined

                  <Directory "/var/www/html">
                  AllowOverride all
                  </Directory>

                  </VirtualHost>


                  For more information refer magento 2 devdocs



                  https://devdocs.magento.com/guides/v2.3/install-gde/tutorials/change-docroot-to-pub.html






                  share|improve this answer













                  You can achieve this by updating your virtual host file, you need to change DocumentRoot DocumentRoot /var/www/html/magento2ce/pub:



                  Example code:



                  <VirtualHost *:80>

                  ServerAdmin webmaster@localhost
                  DocumentRoot /var/www/html/magento2ce/pub

                  ErrorLog $APACHE_LOG_DIR/error.log
                  CustomLog $APACHE_LOG_DIR/access.log combined

                  <Directory "/var/www/html">
                  AllowOverride all
                  </Directory>

                  </VirtualHost>


                  For more information refer magento 2 devdocs



                  https://devdocs.magento.com/guides/v2.3/install-gde/tutorials/change-docroot-to-pub.html







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 14 at 12:24









                  Saphal JhaSaphal Jha

                  1,052616




                  1,052616























                      2














                      To set webroot to pub you will have to tell Magento where the pub folder actually is with something like this



                      #File: pub/index.php
                      $params = $_SERVER;
                      $params[Mage::PARAM_APP_URIS][Mage_Core_Model_Dir::PUB] = '';
                      $entryPoint = new Mage_Core_Model_EntryPoint_Http(new Mage_Core_Model_Config_Primary(BP, $params));


                      You can also refer to https://alanstorm.com/magento-2-the-pub-folder/. But be ready to face some problems. You can find some of the problems you will face here https://github.com/magento/magento2/issues/15092






                      share|improve this answer



























                        2














                        To set webroot to pub you will have to tell Magento where the pub folder actually is with something like this



                        #File: pub/index.php
                        $params = $_SERVER;
                        $params[Mage::PARAM_APP_URIS][Mage_Core_Model_Dir::PUB] = '';
                        $entryPoint = new Mage_Core_Model_EntryPoint_Http(new Mage_Core_Model_Config_Primary(BP, $params));


                        You can also refer to https://alanstorm.com/magento-2-the-pub-folder/. But be ready to face some problems. You can find some of the problems you will face here https://github.com/magento/magento2/issues/15092






                        share|improve this answer

























                          2












                          2








                          2







                          To set webroot to pub you will have to tell Magento where the pub folder actually is with something like this



                          #File: pub/index.php
                          $params = $_SERVER;
                          $params[Mage::PARAM_APP_URIS][Mage_Core_Model_Dir::PUB] = '';
                          $entryPoint = new Mage_Core_Model_EntryPoint_Http(new Mage_Core_Model_Config_Primary(BP, $params));


                          You can also refer to https://alanstorm.com/magento-2-the-pub-folder/. But be ready to face some problems. You can find some of the problems you will face here https://github.com/magento/magento2/issues/15092






                          share|improve this answer













                          To set webroot to pub you will have to tell Magento where the pub folder actually is with something like this



                          #File: pub/index.php
                          $params = $_SERVER;
                          $params[Mage::PARAM_APP_URIS][Mage_Core_Model_Dir::PUB] = '';
                          $entryPoint = new Mage_Core_Model_EntryPoint_Http(new Mage_Core_Model_Config_Primary(BP, $params));


                          You can also refer to https://alanstorm.com/magento-2-the-pub-folder/. But be ready to face some problems. You can find some of the problems you will face here https://github.com/magento/magento2/issues/15092







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered May 14 at 12:25









                          surbhi agrsurbhi agr

                          48312




                          48312



























                              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%2f274547%2fhow-to-set-the-webroot-in-magento-2%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