What does $1 [QSA,L] mean in my .htaccess file?









up vote
86
down vote

favorite
27












I need to change my .htaccess and there are two lines which I don't understand.



RewriteCond %REQUEST_FILENAME !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]


When I should use these lines ?










share|improve this question



















  • 2




    Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
    – Jo Smo
    Aug 7 '14 at 18:08














up vote
86
down vote

favorite
27












I need to change my .htaccess and there are two lines which I don't understand.



RewriteCond %REQUEST_FILENAME !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]


When I should use these lines ?










share|improve this question



















  • 2




    Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
    – Jo Smo
    Aug 7 '14 at 18:08












up vote
86
down vote

favorite
27









up vote
86
down vote

favorite
27






27





I need to change my .htaccess and there are two lines which I don't understand.



RewriteCond %REQUEST_FILENAME !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]


When I should use these lines ?










share|improve this question















I need to change my .htaccess and there are two lines which I don't understand.



RewriteCond %REQUEST_FILENAME !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]


When I should use these lines ?







.htaccess






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 24 '12 at 22:14









Kev

96.4k44262353




96.4k44262353










asked Sep 23 '12 at 10:05









yossi

6511613




6511613







  • 2




    Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
    – Jo Smo
    Aug 7 '14 at 18:08












  • 2




    Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
    – Jo Smo
    Aug 7 '14 at 18:08







2




2




Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
– Jo Smo
Aug 7 '14 at 18:08




Read this: httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa
– Jo Smo
Aug 7 '14 at 18:08












3 Answers
3






active

oldest

votes

















up vote
193
down vote



accepted










Not the place to give a complete tutorial, but here it is in short;



RewriteCond basically means "execute the next RewriteRule only if this is true". The !-l path is the condition that the request is not for a link (! means not, -l means link)



The RewriteRule basically means that if the request is done that matches ^(.+)$ (matches any URL except the server root), it will be rewritten as index.php?url=$1 which means a request for ollewill be rewritten as index.php?url=olle).



QSA means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1 will be rewritten as index.php?url=olle&p=1.



L means if the rule matches, don't process any more RewriteRules below this one.



For more complete info on this, follow the links above. The rewrite support can be a bit hard to grasp, but there are quite a few examples on stackoverflow to learn from.






share|improve this answer






















  • QSA replaces ? to &, making it impossible to distinguish between /page&foobar vs /page?foobar. How can I stop QSA from replacing ? to &?
    – Pacerier
    Sep 27 '17 at 6:04


















up vote
6
down vote













If the following conditions are true, then rewrite the URL:

If the requested filename is not a directory,



RewriteCond %REQUEST_FILENAME !-d


and if the requested filename is not a regular file that exists,



RewriteCond %REQUEST_FILENAME !-f


and if the requested filename is not a symbolic link,



RewriteCond %REQUEST_FILENAME !-l



then rewrite the URL in the following way:

Take the whole request filename and provide it as the value of a "url" query parameter to index.php. Append any query string from the original URL as further query parameters (QSA), and stop processing this .htaccess file (L).



RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]





share|improve this answer



























    up vote
    0
    down vote













    This will capture requests for files like version,
    release, and README.md, etc. which should be
    treated either as endpoints, if defined (as in the
    case of /release), or as "not found."






    share|improve this answer




















      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      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',
      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%2fstackoverflow.com%2fquestions%2f12551382%2fwhat-does-1-qsa-l-mean-in-my-htaccess-file%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








      up vote
      193
      down vote



      accepted










      Not the place to give a complete tutorial, but here it is in short;



      RewriteCond basically means "execute the next RewriteRule only if this is true". The !-l path is the condition that the request is not for a link (! means not, -l means link)



      The RewriteRule basically means that if the request is done that matches ^(.+)$ (matches any URL except the server root), it will be rewritten as index.php?url=$1 which means a request for ollewill be rewritten as index.php?url=olle).



      QSA means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1 will be rewritten as index.php?url=olle&p=1.



      L means if the rule matches, don't process any more RewriteRules below this one.



      For more complete info on this, follow the links above. The rewrite support can be a bit hard to grasp, but there are quite a few examples on stackoverflow to learn from.






      share|improve this answer






















      • QSA replaces ? to &, making it impossible to distinguish between /page&foobar vs /page?foobar. How can I stop QSA from replacing ? to &?
        – Pacerier
        Sep 27 '17 at 6:04















      up vote
      193
      down vote



      accepted










      Not the place to give a complete tutorial, but here it is in short;



      RewriteCond basically means "execute the next RewriteRule only if this is true". The !-l path is the condition that the request is not for a link (! means not, -l means link)



      The RewriteRule basically means that if the request is done that matches ^(.+)$ (matches any URL except the server root), it will be rewritten as index.php?url=$1 which means a request for ollewill be rewritten as index.php?url=olle).



      QSA means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1 will be rewritten as index.php?url=olle&p=1.



      L means if the rule matches, don't process any more RewriteRules below this one.



      For more complete info on this, follow the links above. The rewrite support can be a bit hard to grasp, but there are quite a few examples on stackoverflow to learn from.






      share|improve this answer






















      • QSA replaces ? to &, making it impossible to distinguish between /page&foobar vs /page?foobar. How can I stop QSA from replacing ? to &?
        – Pacerier
        Sep 27 '17 at 6:04













      up vote
      193
      down vote



      accepted







      up vote
      193
      down vote



      accepted






      Not the place to give a complete tutorial, but here it is in short;



      RewriteCond basically means "execute the next RewriteRule only if this is true". The !-l path is the condition that the request is not for a link (! means not, -l means link)



      The RewriteRule basically means that if the request is done that matches ^(.+)$ (matches any URL except the server root), it will be rewritten as index.php?url=$1 which means a request for ollewill be rewritten as index.php?url=olle).



      QSA means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1 will be rewritten as index.php?url=olle&p=1.



      L means if the rule matches, don't process any more RewriteRules below this one.



      For more complete info on this, follow the links above. The rewrite support can be a bit hard to grasp, but there are quite a few examples on stackoverflow to learn from.






      share|improve this answer














      Not the place to give a complete tutorial, but here it is in short;



      RewriteCond basically means "execute the next RewriteRule only if this is true". The !-l path is the condition that the request is not for a link (! means not, -l means link)



      The RewriteRule basically means that if the request is done that matches ^(.+)$ (matches any URL except the server root), it will be rewritten as index.php?url=$1 which means a request for ollewill be rewritten as index.php?url=olle).



      QSA means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1 will be rewritten as index.php?url=olle&p=1.



      L means if the rule matches, don't process any more RewriteRules below this one.



      For more complete info on this, follow the links above. The rewrite support can be a bit hard to grasp, but there are quite a few examples on stackoverflow to learn from.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Nov 10 at 5:39









      SherylHohman

      4,33663245




      4,33663245










      answered Sep 23 '12 at 10:30









      Joachim Isaksson

      141k16199238




      141k16199238











      • QSA replaces ? to &, making it impossible to distinguish between /page&foobar vs /page?foobar. How can I stop QSA from replacing ? to &?
        – Pacerier
        Sep 27 '17 at 6:04

















      • QSA replaces ? to &, making it impossible to distinguish between /page&foobar vs /page?foobar. How can I stop QSA from replacing ? to &?
        – Pacerier
        Sep 27 '17 at 6:04
















      QSA replaces ? to &, making it impossible to distinguish between /page&foobar vs /page?foobar. How can I stop QSA from replacing ? to &?
      – Pacerier
      Sep 27 '17 at 6:04





      QSA replaces ? to &, making it impossible to distinguish between /page&foobar vs /page?foobar. How can I stop QSA from replacing ? to &?
      – Pacerier
      Sep 27 '17 at 6:04













      up vote
      6
      down vote













      If the following conditions are true, then rewrite the URL:

      If the requested filename is not a directory,



      RewriteCond %REQUEST_FILENAME !-d


      and if the requested filename is not a regular file that exists,



      RewriteCond %REQUEST_FILENAME !-f


      and if the requested filename is not a symbolic link,



      RewriteCond %REQUEST_FILENAME !-l



      then rewrite the URL in the following way:

      Take the whole request filename and provide it as the value of a "url" query parameter to index.php. Append any query string from the original URL as further query parameters (QSA), and stop processing this .htaccess file (L).



      RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]





      share|improve this answer
























        up vote
        6
        down vote













        If the following conditions are true, then rewrite the URL:

        If the requested filename is not a directory,



        RewriteCond %REQUEST_FILENAME !-d


        and if the requested filename is not a regular file that exists,



        RewriteCond %REQUEST_FILENAME !-f


        and if the requested filename is not a symbolic link,



        RewriteCond %REQUEST_FILENAME !-l



        then rewrite the URL in the following way:

        Take the whole request filename and provide it as the value of a "url" query parameter to index.php. Append any query string from the original URL as further query parameters (QSA), and stop processing this .htaccess file (L).



        RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]





        share|improve this answer






















          up vote
          6
          down vote










          up vote
          6
          down vote









          If the following conditions are true, then rewrite the URL:

          If the requested filename is not a directory,



          RewriteCond %REQUEST_FILENAME !-d


          and if the requested filename is not a regular file that exists,



          RewriteCond %REQUEST_FILENAME !-f


          and if the requested filename is not a symbolic link,



          RewriteCond %REQUEST_FILENAME !-l



          then rewrite the URL in the following way:

          Take the whole request filename and provide it as the value of a "url" query parameter to index.php. Append any query string from the original URL as further query parameters (QSA), and stop processing this .htaccess file (L).



          RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]





          share|improve this answer












          If the following conditions are true, then rewrite the URL:

          If the requested filename is not a directory,



          RewriteCond %REQUEST_FILENAME !-d


          and if the requested filename is not a regular file that exists,



          RewriteCond %REQUEST_FILENAME !-f


          and if the requested filename is not a symbolic link,



          RewriteCond %REQUEST_FILENAME !-l



          then rewrite the URL in the following way:

          Take the whole request filename and provide it as the value of a "url" query parameter to index.php. Append any query string from the original URL as further query parameters (QSA), and stop processing this .htaccess file (L).



          RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 21 '17 at 0:03









          antelove

          66547




          66547




















              up vote
              0
              down vote













              This will capture requests for files like version,
              release, and README.md, etc. which should be
              treated either as endpoints, if defined (as in the
              case of /release), or as "not found."






              share|improve this answer
























                up vote
                0
                down vote













                This will capture requests for files like version,
                release, and README.md, etc. which should be
                treated either as endpoints, if defined (as in the
                case of /release), or as "not found."






                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  This will capture requests for files like version,
                  release, and README.md, etc. which should be
                  treated either as endpoints, if defined (as in the
                  case of /release), or as "not found."






                  share|improve this answer












                  This will capture requests for files like version,
                  release, and README.md, etc. which should be
                  treated either as endpoints, if defined (as in the
                  case of /release), or as "not found."







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 13 '17 at 4:50









                  Pyae Sone

                  293312




                  293312



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • 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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2fstackoverflow.com%2fquestions%2f12551382%2fwhat-does-1-qsa-l-mean-in-my-htaccess-file%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

                      Darth Vader #20

                      How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                      Ondo