404 not found magento 2 static and media files not loading












1















**resources not loading after changing base url**
resources not loading after changing base url. i have tried changing base_url for media files.










share|improve this question


















  • 4





    Possible duplicate of Magento 2 CSS and JavaScript not loading from correct folder

    – Asish Hira
    Apr 28 '16 at 8:05











  • my problem is that magento is looking directly in root floder for media and static files. it is not looking in pub/media folder

    – usama
    Apr 28 '16 at 8:15






  • 1





    Check the presence of .htaccess file inside pub/static. While Deleting the files under pub/static to get rid of any existing symlinks, we need to be be careful not to delete the .htaccess file.

    – Suyash Kumar Bharti
    Jan 9 '17 at 11:37
















1















**resources not loading after changing base url**
resources not loading after changing base url. i have tried changing base_url for media files.










share|improve this question


















  • 4





    Possible duplicate of Magento 2 CSS and JavaScript not loading from correct folder

    – Asish Hira
    Apr 28 '16 at 8:05











  • my problem is that magento is looking directly in root floder for media and static files. it is not looking in pub/media folder

    – usama
    Apr 28 '16 at 8:15






  • 1





    Check the presence of .htaccess file inside pub/static. While Deleting the files under pub/static to get rid of any existing symlinks, we need to be be careful not to delete the .htaccess file.

    – Suyash Kumar Bharti
    Jan 9 '17 at 11:37














1












1








1








**resources not loading after changing base url**
resources not loading after changing base url. i have tried changing base_url for media files.










share|improve this question














**resources not loading after changing base url**
resources not loading after changing base url. i have tried changing base_url for media files.







magento2 404 base-url






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 28 '16 at 7:48









usamausama

912




912








  • 4





    Possible duplicate of Magento 2 CSS and JavaScript not loading from correct folder

    – Asish Hira
    Apr 28 '16 at 8:05











  • my problem is that magento is looking directly in root floder for media and static files. it is not looking in pub/media folder

    – usama
    Apr 28 '16 at 8:15






  • 1





    Check the presence of .htaccess file inside pub/static. While Deleting the files under pub/static to get rid of any existing symlinks, we need to be be careful not to delete the .htaccess file.

    – Suyash Kumar Bharti
    Jan 9 '17 at 11:37














  • 4





    Possible duplicate of Magento 2 CSS and JavaScript not loading from correct folder

    – Asish Hira
    Apr 28 '16 at 8:05











  • my problem is that magento is looking directly in root floder for media and static files. it is not looking in pub/media folder

    – usama
    Apr 28 '16 at 8:15






  • 1





    Check the presence of .htaccess file inside pub/static. While Deleting the files under pub/static to get rid of any existing symlinks, we need to be be careful not to delete the .htaccess file.

    – Suyash Kumar Bharti
    Jan 9 '17 at 11:37








4




4





Possible duplicate of Magento 2 CSS and JavaScript not loading from correct folder

– Asish Hira
Apr 28 '16 at 8:05





Possible duplicate of Magento 2 CSS and JavaScript not loading from correct folder

– Asish Hira
Apr 28 '16 at 8:05













my problem is that magento is looking directly in root floder for media and static files. it is not looking in pub/media folder

– usama
Apr 28 '16 at 8:15





my problem is that magento is looking directly in root floder for media and static files. it is not looking in pub/media folder

– usama
Apr 28 '16 at 8:15




1




1





Check the presence of .htaccess file inside pub/static. While Deleting the files under pub/static to get rid of any existing symlinks, we need to be be careful not to delete the .htaccess file.

– Suyash Kumar Bharti
Jan 9 '17 at 11:37





Check the presence of .htaccess file inside pub/static. While Deleting the files under pub/static to get rid of any existing symlinks, we need to be be careful not to delete the .htaccess file.

– Suyash Kumar Bharti
Jan 9 '17 at 11:37










5 Answers
5






active

oldest

votes


















2














In your magento root directory run the below command..



for windows system:
php bin/magento setup:static-content:deploy



For Linux/Ubuntu:
bin/magento setup:static-content:deploy






share|improve this answer































    2














    Magento 2.2.2



    Apache/2.4.6 (CentOS)



    I tried:



    rm -rf pub/static/* generated/* var/page_cache/* var/cache/* var/view_preprocessed/*
    chown -R apache:apache .*
    find . -type d -exec chmod 0770 {} ;
    find . -type f -exec chmod 0660 {} ;
    php bin/magento cache:clean
    php bin/magento setup:upgrade
    php bin/magento setup:di:compile
    php bin/magento setup:static-content:deploy -f


    Found out the pub/static/.htaccess file was missing. Added it back in and static content showed up.






    share|improve this answer



















    • 1





      big thanks Bernard, you saved my day :)

      – Eugen Bogdanovich
      Apr 9 '18 at 7:55





















    1














    I had the same issue in magento 2, Ubuntu 16.04. You can resolve it by running the following command in your magento 2 root directory




    sudo php bin/magento setup:static-content:deploy




    In case it gives a warning and fails, run the above command forcibly, like,




    sudo php bin/magento setup:static-content:deploy -f




    Post this step, you will have to compile magento setup once again. So, run the following command.




    sudo php bin/magento setup:di:compile







    share|improve this answer































      0














      None of this worked for me. The problem was apache. Needed to set AllowOverride All in the virtualhost due to Magento's many many .htaccess files.






      share|improve this answer































        0














        Hello If your apache version is greater then 2.4 and you have share hosting then you need to follow this steps.





        Open all .htaccess files



        your_magento_setup/.htaccess,
        pub/.htaccess



        Then you just comment this tag fully in your both htaccess.



        <IfVersion >= 2.4>


        Your magento 2 setup working properly.. IF Not working then you can contact me on this Email kamalj27@gmail.com






        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%2f113053%2f404-not-found-magento-2-static-and-media-files-not-loading%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          In your magento root directory run the below command..



          for windows system:
          php bin/magento setup:static-content:deploy



          For Linux/Ubuntu:
          bin/magento setup:static-content:deploy






          share|improve this answer




























            2














            In your magento root directory run the below command..



            for windows system:
            php bin/magento setup:static-content:deploy



            For Linux/Ubuntu:
            bin/magento setup:static-content:deploy






            share|improve this answer


























              2












              2








              2







              In your magento root directory run the below command..



              for windows system:
              php bin/magento setup:static-content:deploy



              For Linux/Ubuntu:
              bin/magento setup:static-content:deploy






              share|improve this answer













              In your magento root directory run the below command..



              for windows system:
              php bin/magento setup:static-content:deploy



              For Linux/Ubuntu:
              bin/magento setup:static-content:deploy







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Apr 28 '16 at 7:52









              Mohammad MujassamMohammad Mujassam

              1,1171227




              1,1171227

























                  2














                  Magento 2.2.2



                  Apache/2.4.6 (CentOS)



                  I tried:



                  rm -rf pub/static/* generated/* var/page_cache/* var/cache/* var/view_preprocessed/*
                  chown -R apache:apache .*
                  find . -type d -exec chmod 0770 {} ;
                  find . -type f -exec chmod 0660 {} ;
                  php bin/magento cache:clean
                  php bin/magento setup:upgrade
                  php bin/magento setup:di:compile
                  php bin/magento setup:static-content:deploy -f


                  Found out the pub/static/.htaccess file was missing. Added it back in and static content showed up.






                  share|improve this answer



















                  • 1





                    big thanks Bernard, you saved my day :)

                    – Eugen Bogdanovich
                    Apr 9 '18 at 7:55


















                  2














                  Magento 2.2.2



                  Apache/2.4.6 (CentOS)



                  I tried:



                  rm -rf pub/static/* generated/* var/page_cache/* var/cache/* var/view_preprocessed/*
                  chown -R apache:apache .*
                  find . -type d -exec chmod 0770 {} ;
                  find . -type f -exec chmod 0660 {} ;
                  php bin/magento cache:clean
                  php bin/magento setup:upgrade
                  php bin/magento setup:di:compile
                  php bin/magento setup:static-content:deploy -f


                  Found out the pub/static/.htaccess file was missing. Added it back in and static content showed up.






                  share|improve this answer



















                  • 1





                    big thanks Bernard, you saved my day :)

                    – Eugen Bogdanovich
                    Apr 9 '18 at 7:55
















                  2












                  2








                  2







                  Magento 2.2.2



                  Apache/2.4.6 (CentOS)



                  I tried:



                  rm -rf pub/static/* generated/* var/page_cache/* var/cache/* var/view_preprocessed/*
                  chown -R apache:apache .*
                  find . -type d -exec chmod 0770 {} ;
                  find . -type f -exec chmod 0660 {} ;
                  php bin/magento cache:clean
                  php bin/magento setup:upgrade
                  php bin/magento setup:di:compile
                  php bin/magento setup:static-content:deploy -f


                  Found out the pub/static/.htaccess file was missing. Added it back in and static content showed up.






                  share|improve this answer













                  Magento 2.2.2



                  Apache/2.4.6 (CentOS)



                  I tried:



                  rm -rf pub/static/* generated/* var/page_cache/* var/cache/* var/view_preprocessed/*
                  chown -R apache:apache .*
                  find . -type d -exec chmod 0770 {} ;
                  find . -type f -exec chmod 0660 {} ;
                  php bin/magento cache:clean
                  php bin/magento setup:upgrade
                  php bin/magento setup:di:compile
                  php bin/magento setup:static-content:deploy -f


                  Found out the pub/static/.htaccess file was missing. Added it back in and static content showed up.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 27 '17 at 14:31









                  BernardBernard

                  1306




                  1306








                  • 1





                    big thanks Bernard, you saved my day :)

                    – Eugen Bogdanovich
                    Apr 9 '18 at 7:55
















                  • 1





                    big thanks Bernard, you saved my day :)

                    – Eugen Bogdanovich
                    Apr 9 '18 at 7:55










                  1




                  1





                  big thanks Bernard, you saved my day :)

                  – Eugen Bogdanovich
                  Apr 9 '18 at 7:55







                  big thanks Bernard, you saved my day :)

                  – Eugen Bogdanovich
                  Apr 9 '18 at 7:55













                  1














                  I had the same issue in magento 2, Ubuntu 16.04. You can resolve it by running the following command in your magento 2 root directory




                  sudo php bin/magento setup:static-content:deploy




                  In case it gives a warning and fails, run the above command forcibly, like,




                  sudo php bin/magento setup:static-content:deploy -f




                  Post this step, you will have to compile magento setup once again. So, run the following command.




                  sudo php bin/magento setup:di:compile







                  share|improve this answer




























                    1














                    I had the same issue in magento 2, Ubuntu 16.04. You can resolve it by running the following command in your magento 2 root directory




                    sudo php bin/magento setup:static-content:deploy




                    In case it gives a warning and fails, run the above command forcibly, like,




                    sudo php bin/magento setup:static-content:deploy -f




                    Post this step, you will have to compile magento setup once again. So, run the following command.




                    sudo php bin/magento setup:di:compile







                    share|improve this answer


























                      1












                      1








                      1







                      I had the same issue in magento 2, Ubuntu 16.04. You can resolve it by running the following command in your magento 2 root directory




                      sudo php bin/magento setup:static-content:deploy




                      In case it gives a warning and fails, run the above command forcibly, like,




                      sudo php bin/magento setup:static-content:deploy -f




                      Post this step, you will have to compile magento setup once again. So, run the following command.




                      sudo php bin/magento setup:di:compile







                      share|improve this answer













                      I had the same issue in magento 2, Ubuntu 16.04. You can resolve it by running the following command in your magento 2 root directory




                      sudo php bin/magento setup:static-content:deploy




                      In case it gives a warning and fails, run the above command forcibly, like,




                      sudo php bin/magento setup:static-content:deploy -f




                      Post this step, you will have to compile magento setup once again. So, run the following command.




                      sudo php bin/magento setup:di:compile








                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Oct 7 '16 at 6:27









                      AzherAzher

                      112




                      112























                          0














                          None of this worked for me. The problem was apache. Needed to set AllowOverride All in the virtualhost due to Magento's many many .htaccess files.






                          share|improve this answer




























                            0














                            None of this worked for me. The problem was apache. Needed to set AllowOverride All in the virtualhost due to Magento's many many .htaccess files.






                            share|improve this answer


























                              0












                              0








                              0







                              None of this worked for me. The problem was apache. Needed to set AllowOverride All in the virtualhost due to Magento's many many .htaccess files.






                              share|improve this answer













                              None of this worked for me. The problem was apache. Needed to set AllowOverride All in the virtualhost due to Magento's many many .htaccess files.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Nov 13 '18 at 22:14









                              David DomingoDavid Domingo

                              101




                              101























                                  0














                                  Hello If your apache version is greater then 2.4 and you have share hosting then you need to follow this steps.





                                  Open all .htaccess files



                                  your_magento_setup/.htaccess,
                                  pub/.htaccess



                                  Then you just comment this tag fully in your both htaccess.



                                  <IfVersion >= 2.4>


                                  Your magento 2 setup working properly.. IF Not working then you can contact me on this Email kamalj27@gmail.com






                                  share|improve this answer




























                                    0














                                    Hello If your apache version is greater then 2.4 and you have share hosting then you need to follow this steps.





                                    Open all .htaccess files



                                    your_magento_setup/.htaccess,
                                    pub/.htaccess



                                    Then you just comment this tag fully in your both htaccess.



                                    <IfVersion >= 2.4>


                                    Your magento 2 setup working properly.. IF Not working then you can contact me on this Email kamalj27@gmail.com






                                    share|improve this answer


























                                      0












                                      0








                                      0







                                      Hello If your apache version is greater then 2.4 and you have share hosting then you need to follow this steps.





                                      Open all .htaccess files



                                      your_magento_setup/.htaccess,
                                      pub/.htaccess



                                      Then you just comment this tag fully in your both htaccess.



                                      <IfVersion >= 2.4>


                                      Your magento 2 setup working properly.. IF Not working then you can contact me on this Email kamalj27@gmail.com






                                      share|improve this answer













                                      Hello If your apache version is greater then 2.4 and you have share hosting then you need to follow this steps.





                                      Open all .htaccess files



                                      your_magento_setup/.htaccess,
                                      pub/.htaccess



                                      Then you just comment this tag fully in your both htaccess.



                                      <IfVersion >= 2.4>


                                      Your magento 2 setup working properly.. IF Not working then you can contact me on this Email kamalj27@gmail.com







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered 25 mins ago









                                      Kamal JainKamal Jain

                                      414




                                      414






























                                          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%2f113053%2f404-not-found-magento-2-static-and-media-files-not-loading%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

                                          Magento 2 controller redirect on button click in phtml file

                                          Polycentropodidae