SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    380
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [R=301,L] - What does L mean?

    [R=301,L] - What does L mean? From what I found, it means " Same as 'last'
    ". What *exactly* does this mean?

    From the following two commands, which one is the better one?

    RewriteRule (.*) http://somesite.tld/$1 [R=301,L]

    OR

    RewriteRule (.*) http://somesite.tld/$1 [R=301]

  2. #2
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That means it is the Last rewrite rule and stops looping and/or conflicts.

  3. #3
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    380
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!

    So, it's better to use

    RewriteRule (.*) http://somesite.tld/$1 [R=301,L]

    OR

    RewriteRule (.*) http://somesite.tld/$1 [R=301]

    ?

  4. #4
    Free your mind Toly's Avatar
    Join Date
    Sep 2001
    Location
    Panama
    Posts
    2,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Basically, if you have a lot of rewrite rules, it'd be better to add the L flag to save Apache from having to keep processing further rules.
    Community Guidelines | Community FAQ

    "He that is kind is free, though he is a slave;
    he that is evil is a slave, though he be a king." - St. Augustine

  5. #5
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Cris,

    It's my understanding that the Last flag acts as a }, i.e., it closes a BLOCK of rewrite conditions and rules so, as you would use } to close a block of PHP statements, so would you use [L] to close a "block" of mod_rewrite statements.

    That said, it's best to use [L] at the end of EACH RewriteRule unless it's to chain to another rule - [R=301,L] is highly recommended.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •