Magento prepending /pub/ directory to all CSS and JS filesHow do I disable merged CSS and JSMagento links missing index.php and are showing 404 errorHow can I find all config entries for enabled payment or shipping methods and copy them to another store?Magento 2: What is the best practice of storing and retrieving custom data

A spacecraft is travelling at X units per hour. But relative to what exactly? Does it depend on orbit? How?

I have found a mistake on someone's code published online: what is the protocol?

Does unblocking power bar outlets through short extension cords increase fire risk?

When a ball on a rope swings in a circle, is there both centripetal force and tension force?

What does "mossette" translate to in English

Locked-up DOS computer beeped on keypress. What mechanism caused that?

Could Europeans in Europe demand protection under UN Declaration on the Rights of Indigenous Peoples?

Somebody hacked my clock

Who or what determines if a curse is valid or not?

I want light controlled by one switch, not two

You have no, but can try for yes

Does a hash function have a Upper bound on input length?

Discontinuous Tube visualization

What makes MOVEQ quicker than a normal MOVE in 68000 assembly?

Do higher dimensions have axes?

How was Luke's prosthetic hand in Episode V filmed?

Is "repository" pronounced /rɪˈpɒzɪt(ə)ri/ or ri-ˈpä-zə-ˌtȯr-ē or /rəˈpäzəˌtôrē/?

Are there any satellites in geosynchronous but not geostationary orbits?

Making a Dataset that emulates `ls -tlra`?

Inscriptio Labyrinthica

Formating slide

Align the contents of a numerical matrix when you have minus signs

Why should fork() have been designed to return a file descriptor?

Why don't humans perceive sound waves as twice the frequency they are?



Magento prepending /pub/ directory to all CSS and JS files


How do I disable merged CSS and JSMagento links missing index.php and are showing 404 errorHow can I find all config entries for enabled payment or shipping methods and copy them to another store?Magento 2: What is the best practice of storing and retrieving custom data






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








0















In order to perform the Magento 2 install via a web browser, I had set the Apache DOCUMENT_ROOT as /var/www/magento/. After completing the install, I moved the DOCUMENT_ROOT to /var/www/magento/pub/. However, the CSS and JS files linked in pages have the /pub/ directory prepended to them:



$ curl -s http://127.0.0.1:8033/ | grep requirejs-config.js
<script type="text/javascript" src="http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js"></script>

$ curl -I http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js
HTTP/1.1 404 Not Found


Simply removing that /pub/ directory returns the proper file:



$ curl -I http://127.0.0.1:8033/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js
HTTP/1.1 200 OK


I see that the base_url configs are set properly in the database. Note that I did not change these, they sems to already be set:



mysql> select * from core_config_data where path in ("web/secure/base_url", "web/unsecure/base_url");
+-----------+---------+----------+-----------------------+-------------------------+
| config_id | scope | scope_id | path | value |
+-----------+---------+----------+-----------------------+-------------------------+
| 2 | default | 0 | web/unsecure/base_url | http://127.0.0.1:8033/ |
| 3 | default | 0 | web/secure/base_url | https://127.0.0.1:8033/ |
+-----------+---------+----------+-----------------------+-------------------------+


I have ensured that .htaccess is being read and parsed properly, and I've ensured that the files are being served from the right place.



$ cat t.html
magento root
$ cat pub/t.html
pub
$ curl http://127.0.0.1:8033/t.html
pub


Of course, the .htaccess file's RewriteBase directive is not being used (commented out, as default):



$ grep RewriteBase pub/.htaccess
#RewriteBase /magento/
$ grep RewriteBase .htaccess
#RewriteBase /magento/


I did try setting the RewriteBase directive to simply / but that made no difference.



I did notice this code in the HTML head tag:



<script>
var BASE_URL = 'http://127.0.0.1:8033/';
var require =
"baseUrl": "http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US"
;
</script>


From where is this baseUrl configured? I even did a MySQL dump and grepped for the string pub but found nothing relevant:



$ mysqldump --skip-extended-insert -P23306 -u -p magento > q.sql
$ grep pub q.sql | grep -v msp_tfa_country_codes
`public_hash` varchar(128) NOT NULL COMMENT 'Hash code for using on frontend',
UNIQUE KEY `VAULT_PAYMENT_TOKEN_PUBLIC_HASH` (`public_hash`),


From where is this baseUrl configured?










share|improve this question




























    0















    In order to perform the Magento 2 install via a web browser, I had set the Apache DOCUMENT_ROOT as /var/www/magento/. After completing the install, I moved the DOCUMENT_ROOT to /var/www/magento/pub/. However, the CSS and JS files linked in pages have the /pub/ directory prepended to them:



    $ curl -s http://127.0.0.1:8033/ | grep requirejs-config.js
    <script type="text/javascript" src="http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js"></script>

    $ curl -I http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js
    HTTP/1.1 404 Not Found


    Simply removing that /pub/ directory returns the proper file:



    $ curl -I http://127.0.0.1:8033/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js
    HTTP/1.1 200 OK


    I see that the base_url configs are set properly in the database. Note that I did not change these, they sems to already be set:



    mysql> select * from core_config_data where path in ("web/secure/base_url", "web/unsecure/base_url");
    +-----------+---------+----------+-----------------------+-------------------------+
    | config_id | scope | scope_id | path | value |
    +-----------+---------+----------+-----------------------+-------------------------+
    | 2 | default | 0 | web/unsecure/base_url | http://127.0.0.1:8033/ |
    | 3 | default | 0 | web/secure/base_url | https://127.0.0.1:8033/ |
    +-----------+---------+----------+-----------------------+-------------------------+


    I have ensured that .htaccess is being read and parsed properly, and I've ensured that the files are being served from the right place.



    $ cat t.html
    magento root
    $ cat pub/t.html
    pub
    $ curl http://127.0.0.1:8033/t.html
    pub


    Of course, the .htaccess file's RewriteBase directive is not being used (commented out, as default):



    $ grep RewriteBase pub/.htaccess
    #RewriteBase /magento/
    $ grep RewriteBase .htaccess
    #RewriteBase /magento/


    I did try setting the RewriteBase directive to simply / but that made no difference.



    I did notice this code in the HTML head tag:



    <script>
    var BASE_URL = 'http://127.0.0.1:8033/';
    var require =
    "baseUrl": "http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US"
    ;
    </script>


    From where is this baseUrl configured? I even did a MySQL dump and grepped for the string pub but found nothing relevant:



    $ mysqldump --skip-extended-insert -P23306 -u -p magento > q.sql
    $ grep pub q.sql | grep -v msp_tfa_country_codes
    `public_hash` varchar(128) NOT NULL COMMENT 'Hash code for using on frontend',
    UNIQUE KEY `VAULT_PAYMENT_TOKEN_PUBLIC_HASH` (`public_hash`),


    From where is this baseUrl configured?










    share|improve this question
























      0












      0








      0








      In order to perform the Magento 2 install via a web browser, I had set the Apache DOCUMENT_ROOT as /var/www/magento/. After completing the install, I moved the DOCUMENT_ROOT to /var/www/magento/pub/. However, the CSS and JS files linked in pages have the /pub/ directory prepended to them:



      $ curl -s http://127.0.0.1:8033/ | grep requirejs-config.js
      <script type="text/javascript" src="http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js"></script>

      $ curl -I http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js
      HTTP/1.1 404 Not Found


      Simply removing that /pub/ directory returns the proper file:



      $ curl -I http://127.0.0.1:8033/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js
      HTTP/1.1 200 OK


      I see that the base_url configs are set properly in the database. Note that I did not change these, they sems to already be set:



      mysql> select * from core_config_data where path in ("web/secure/base_url", "web/unsecure/base_url");
      +-----------+---------+----------+-----------------------+-------------------------+
      | config_id | scope | scope_id | path | value |
      +-----------+---------+----------+-----------------------+-------------------------+
      | 2 | default | 0 | web/unsecure/base_url | http://127.0.0.1:8033/ |
      | 3 | default | 0 | web/secure/base_url | https://127.0.0.1:8033/ |
      +-----------+---------+----------+-----------------------+-------------------------+


      I have ensured that .htaccess is being read and parsed properly, and I've ensured that the files are being served from the right place.



      $ cat t.html
      magento root
      $ cat pub/t.html
      pub
      $ curl http://127.0.0.1:8033/t.html
      pub


      Of course, the .htaccess file's RewriteBase directive is not being used (commented out, as default):



      $ grep RewriteBase pub/.htaccess
      #RewriteBase /magento/
      $ grep RewriteBase .htaccess
      #RewriteBase /magento/


      I did try setting the RewriteBase directive to simply / but that made no difference.



      I did notice this code in the HTML head tag:



      <script>
      var BASE_URL = 'http://127.0.0.1:8033/';
      var require =
      "baseUrl": "http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US"
      ;
      </script>


      From where is this baseUrl configured? I even did a MySQL dump and grepped for the string pub but found nothing relevant:



      $ mysqldump --skip-extended-insert -P23306 -u -p magento > q.sql
      $ grep pub q.sql | grep -v msp_tfa_country_codes
      `public_hash` varchar(128) NOT NULL COMMENT 'Hash code for using on frontend',
      UNIQUE KEY `VAULT_PAYMENT_TOKEN_PUBLIC_HASH` (`public_hash`),


      From where is this baseUrl configured?










      share|improve this question














      In order to perform the Magento 2 install via a web browser, I had set the Apache DOCUMENT_ROOT as /var/www/magento/. After completing the install, I moved the DOCUMENT_ROOT to /var/www/magento/pub/. However, the CSS and JS files linked in pages have the /pub/ directory prepended to them:



      $ curl -s http://127.0.0.1:8033/ | grep requirejs-config.js
      <script type="text/javascript" src="http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js"></script>

      $ curl -I http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js
      HTTP/1.1 404 Not Found


      Simply removing that /pub/ directory returns the proper file:



      $ curl -I http://127.0.0.1:8033/static/version1562767548/frontend/Magento/luma/en_US/requirejs-config.js
      HTTP/1.1 200 OK


      I see that the base_url configs are set properly in the database. Note that I did not change these, they sems to already be set:



      mysql> select * from core_config_data where path in ("web/secure/base_url", "web/unsecure/base_url");
      +-----------+---------+----------+-----------------------+-------------------------+
      | config_id | scope | scope_id | path | value |
      +-----------+---------+----------+-----------------------+-------------------------+
      | 2 | default | 0 | web/unsecure/base_url | http://127.0.0.1:8033/ |
      | 3 | default | 0 | web/secure/base_url | https://127.0.0.1:8033/ |
      +-----------+---------+----------+-----------------------+-------------------------+


      I have ensured that .htaccess is being read and parsed properly, and I've ensured that the files are being served from the right place.



      $ cat t.html
      magento root
      $ cat pub/t.html
      pub
      $ curl http://127.0.0.1:8033/t.html
      pub


      Of course, the .htaccess file's RewriteBase directive is not being used (commented out, as default):



      $ grep RewriteBase pub/.htaccess
      #RewriteBase /magento/
      $ grep RewriteBase .htaccess
      #RewriteBase /magento/


      I did try setting the RewriteBase directive to simply / but that made no difference.



      I did notice this code in the HTML head tag:



      <script>
      var BASE_URL = 'http://127.0.0.1:8033/';
      var require =
      "baseUrl": "http://127.0.0.1:8033/pub/static/version1562767548/frontend/Magento/luma/en_US"
      ;
      </script>


      From where is this baseUrl configured? I even did a MySQL dump and grepped for the string pub but found nothing relevant:



      $ mysqldump --skip-extended-insert -P23306 -u -p magento > q.sql
      $ grep pub q.sql | grep -v msp_tfa_country_codes
      `public_hash` varchar(128) NOT NULL COMMENT 'Hash code for using on frontend',
      UNIQUE KEY `VAULT_PAYMENT_TOKEN_PUBLIC_HASH` (`public_hash`),


      From where is this baseUrl configured?







      core-config-data






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jul 11 at 12:29









      dotancohendotancohen

      1013 bronze badges




      1013 bronze badges




















          0






          active

          oldest

          votes














          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%2f281738%2fmagento-prepending-pub-directory-to-all-css-and-js-files%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          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%2f281738%2fmagento-prepending-pub-directory-to-all-css-and-js-files%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