Enabling .htaccess file to rewrite path (not working)












13















All the tutorials tell me to edit the: /etc/apache2/sites-available/default but this file doesn't exist for me. Within this file I would have to edit the:




<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
#AllowOverride All
#AllowOverride AuthConfig FileInfo Indexes Limit Options=All, MultiViews
Order allow,deny
allow from all </Directory>



What should the file look like and should I create it myself?



Aslo I do have a 000-default.conf file but the above 'code' isn't in there either.










share|improve this question



























    13















    All the tutorials tell me to edit the: /etc/apache2/sites-available/default but this file doesn't exist for me. Within this file I would have to edit the:




    <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    #AllowOverride All
    #AllowOverride AuthConfig FileInfo Indexes Limit Options=All, MultiViews
    Order allow,deny
    allow from all </Directory>



    What should the file look like and should I create it myself?



    Aslo I do have a 000-default.conf file but the above 'code' isn't in there either.










    share|improve this question

























      13












      13








      13


      9






      All the tutorials tell me to edit the: /etc/apache2/sites-available/default but this file doesn't exist for me. Within this file I would have to edit the:




      <Directory /var/www/>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      #AllowOverride All
      #AllowOverride AuthConfig FileInfo Indexes Limit Options=All, MultiViews
      Order allow,deny
      allow from all </Directory>



      What should the file look like and should I create it myself?



      Aslo I do have a 000-default.conf file but the above 'code' isn't in there either.










      share|improve this question














      All the tutorials tell me to edit the: /etc/apache2/sites-available/default but this file doesn't exist for me. Within this file I would have to edit the:




      <Directory /var/www/>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      #AllowOverride All
      #AllowOverride AuthConfig FileInfo Indexes Limit Options=All, MultiViews
      Order allow,deny
      allow from all </Directory>



      What should the file look like and should I create it myself?



      Aslo I do have a 000-default.conf file but the above 'code' isn't in there either.







      apache2 .htaccess mod-rewrite






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 15 '14 at 13:20









      inControlinControl

      168129




      168129






















          3 Answers
          3






          active

          oldest

          votes


















          46














          For apache version 2.4 and later, you have to go to



          /etc/apache2/apache2.conf



          You have to edit that file (you should have root permission). Change directory text like this;



          <Directory /var/www/>
          Options Indexes FollowSymLinks
          AllowOverride All
          Require all granted
          </Directory>


          Now restart apache.



          service apache2 restart


          Hope it works.






          share|improve this answer


























          • Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.

            – chx101
            Apr 16 '17 at 10:04











          • The important line here is AllowOverride All, this means all settings can be set (overridden) in .htaccess files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride

            – jacwah
            Nov 27 '18 at 15:59



















          17














          Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.



          firstly enable a2enmod



          sudo a2enmod rewrite 


          and



          sudo service apache2 restart

          sudo nano /etc/apache2/sites-enabled/000-default.conf


          add these lines at end



          <Directory /var/www/html>
          AllowOverride All
          </Directory>


          and



          sudo service apache2 restart





          share|improve this answer



















          • 1





            This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.

            – kishor10d
            Sep 29 '17 at 18:16






          • 1





            This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.

            – Faisal Sarfraz
            Sep 7 '18 at 7:51



















          9














          If you don't want to repeat the same configurtion at each upgrade / update



          The best way is :



          Edit or create a config file



          /etc/apache2/conf-available/httpd.conf



          Add



          <Directory /var/www/>
          Options Indexes FollowSymLinks
          AllowOverride All
          Require all granted
          </Directory>



          Enable the config file



          sudo a2enconf httpd



          Restart or reload Apache



          sudo service apache2 restart



          or



          sudo service apache2 reload



          It's done!






          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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%2faskubuntu.com%2fquestions%2f421233%2fenabling-htaccess-file-to-rewrite-path-not-working%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            46














            For apache version 2.4 and later, you have to go to



            /etc/apache2/apache2.conf



            You have to edit that file (you should have root permission). Change directory text like this;



            <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
            </Directory>


            Now restart apache.



            service apache2 restart


            Hope it works.






            share|improve this answer


























            • Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.

              – chx101
              Apr 16 '17 at 10:04











            • The important line here is AllowOverride All, this means all settings can be set (overridden) in .htaccess files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride

              – jacwah
              Nov 27 '18 at 15:59
















            46














            For apache version 2.4 and later, you have to go to



            /etc/apache2/apache2.conf



            You have to edit that file (you should have root permission). Change directory text like this;



            <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
            </Directory>


            Now restart apache.



            service apache2 restart


            Hope it works.






            share|improve this answer


























            • Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.

              – chx101
              Apr 16 '17 at 10:04











            • The important line here is AllowOverride All, this means all settings can be set (overridden) in .htaccess files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride

              – jacwah
              Nov 27 '18 at 15:59














            46












            46








            46







            For apache version 2.4 and later, you have to go to



            /etc/apache2/apache2.conf



            You have to edit that file (you should have root permission). Change directory text like this;



            <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
            </Directory>


            Now restart apache.



            service apache2 restart


            Hope it works.






            share|improve this answer















            For apache version 2.4 and later, you have to go to



            /etc/apache2/apache2.conf



            You have to edit that file (you should have root permission). Change directory text like this;



            <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
            </Directory>


            Now restart apache.



            service apache2 restart


            Hope it works.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 3 mins ago









            Ali Çarıkçıoğlu

            1032




            1032










            answered Feb 15 '14 at 13:27









            NabilNabil

            1,49711427




            1,49711427













            • Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.

              – chx101
              Apr 16 '17 at 10:04











            • The important line here is AllowOverride All, this means all settings can be set (overridden) in .htaccess files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride

              – jacwah
              Nov 27 '18 at 15:59



















            • Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.

              – chx101
              Apr 16 '17 at 10:04











            • The important line here is AllowOverride All, this means all settings can be set (overridden) in .htaccess files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride

              – jacwah
              Nov 27 '18 at 15:59

















            Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.

            – chx101
            Apr 16 '17 at 10:04





            Can you please explain what this does? How does this tie in with the .htaccess? My .htaccess in not getting read at all.

            – chx101
            Apr 16 '17 at 10:04













            The important line here is AllowOverride All, this means all settings can be set (overridden) in .htaccess files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride

            – jacwah
            Nov 27 '18 at 15:59





            The important line here is AllowOverride All, this means all settings can be set (overridden) in .htaccess files. See docs: httpd.apache.org/docs/2.4/mod/core.html#allowoverride

            – jacwah
            Nov 27 '18 at 15:59













            17














            Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.



            firstly enable a2enmod



            sudo a2enmod rewrite 


            and



            sudo service apache2 restart

            sudo nano /etc/apache2/sites-enabled/000-default.conf


            add these lines at end



            <Directory /var/www/html>
            AllowOverride All
            </Directory>


            and



            sudo service apache2 restart





            share|improve this answer



















            • 1





              This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.

              – kishor10d
              Sep 29 '17 at 18:16






            • 1





              This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.

              – Faisal Sarfraz
              Sep 7 '18 at 7:51
















            17














            Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.



            firstly enable a2enmod



            sudo a2enmod rewrite 


            and



            sudo service apache2 restart

            sudo nano /etc/apache2/sites-enabled/000-default.conf


            add these lines at end



            <Directory /var/www/html>
            AllowOverride All
            </Directory>


            and



            sudo service apache2 restart





            share|improve this answer



















            • 1





              This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.

              – kishor10d
              Sep 29 '17 at 18:16






            • 1





              This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.

              – Faisal Sarfraz
              Sep 7 '18 at 7:51














            17












            17








            17







            Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.



            firstly enable a2enmod



            sudo a2enmod rewrite 


            and



            sudo service apache2 restart

            sudo nano /etc/apache2/sites-enabled/000-default.conf


            add these lines at end



            <Directory /var/www/html>
            AllowOverride All
            </Directory>


            and



            sudo service apache2 restart





            share|improve this answer













            Ubuntu 14.04 (and Apache 2.4) the default DocumentRoot was changed from /var/www to /var/www/html.



            firstly enable a2enmod



            sudo a2enmod rewrite 


            and



            sudo service apache2 restart

            sudo nano /etc/apache2/sites-enabled/000-default.conf


            add these lines at end



            <Directory /var/www/html>
            AllowOverride All
            </Directory>


            and



            sudo service apache2 restart






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jun 2 '17 at 21:04









            alicanozkaraalicanozkara

            27124




            27124








            • 1





              This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.

              – kishor10d
              Sep 29 '17 at 18:16






            • 1





              This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.

              – Faisal Sarfraz
              Sep 7 '18 at 7:51














            • 1





              This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.

              – kishor10d
              Sep 29 '17 at 18:16






            • 1





              This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.

              – Faisal Sarfraz
              Sep 7 '18 at 7:51








            1




            1





            This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.

            – kishor10d
            Sep 29 '17 at 18:16





            This solution works for me because, I need to enable mod_rewrite first. Thanks a lot.

            – kishor10d
            Sep 29 '17 at 18:16




            1




            1





            This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.

            – Faisal Sarfraz
            Sep 7 '18 at 7:51





            This really worked for apache 2.4. Saved my day. Even after editing maing apache2.conf .htaccess didn't work but doing this way it worked.

            – Faisal Sarfraz
            Sep 7 '18 at 7:51











            9














            If you don't want to repeat the same configurtion at each upgrade / update



            The best way is :



            Edit or create a config file



            /etc/apache2/conf-available/httpd.conf



            Add



            <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
            </Directory>



            Enable the config file



            sudo a2enconf httpd



            Restart or reload Apache



            sudo service apache2 restart



            or



            sudo service apache2 reload



            It's done!






            share|improve this answer






























              9














              If you don't want to repeat the same configurtion at each upgrade / update



              The best way is :



              Edit or create a config file



              /etc/apache2/conf-available/httpd.conf



              Add



              <Directory /var/www/>
              Options Indexes FollowSymLinks
              AllowOverride All
              Require all granted
              </Directory>



              Enable the config file



              sudo a2enconf httpd



              Restart or reload Apache



              sudo service apache2 restart



              or



              sudo service apache2 reload



              It's done!






              share|improve this answer




























                9












                9








                9







                If you don't want to repeat the same configurtion at each upgrade / update



                The best way is :



                Edit or create a config file



                /etc/apache2/conf-available/httpd.conf



                Add



                <Directory /var/www/>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
                </Directory>



                Enable the config file



                sudo a2enconf httpd



                Restart or reload Apache



                sudo service apache2 restart



                or



                sudo service apache2 reload



                It's done!






                share|improve this answer















                If you don't want to repeat the same configurtion at each upgrade / update



                The best way is :



                Edit or create a config file



                /etc/apache2/conf-available/httpd.conf



                Add



                <Directory /var/www/>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
                </Directory>



                Enable the config file



                sudo a2enconf httpd



                Restart or reload Apache



                sudo service apache2 restart



                or



                sudo service apache2 reload



                It's done!







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 2 '18 at 22:43

























                answered Sep 23 '15 at 15:34









                zataminezatamine

                32638




                32638






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • 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%2faskubuntu.com%2fquestions%2f421233%2fenabling-htaccess-file-to-rewrite-path-not-working%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

                    GameSpot

                    日野市

                    Tu-95轟炸機