1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Should I put [L] or [R=301] at end of mod_rewrite?

Discussion in 'Apache' started by Dejavu, Jul 27, 2005.

  1. #1
    Currently I am using a rewrite that looks something like this
    RewriteRule ^(.*)-(.*)$ index.php?c=$1&s=$2
    Code (markup):
    I notice other people on this forum ending the line with [L], or [R=301]., like in the following line

    RewriteRule ^(.*)-(.*)$ index.php?c=$1&s=$2 [L]
    Code (markup):
    or
    RewriteRule ^(.*)-(.*)$ index.php?c=$1&s=$2 [R=301]
    Code (markup):
    or both
    SEMrush
    Is there a difference or a reason for this?
    thanks
     
    Dejavu, Jul 27, 2005 IP
    SEMrush
  2. just-4-teens

    just-4-teens Peon

    Messages:
    3,968
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i think (but not sure) [L] would give a 401 un authorised error and [R=301] would re-direct the visiter
     
    just-4-teens, Jul 27, 2005 IP
  3. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,297
    Likes Received:
    2,602
    Best Answers:
    461
    Trophy Points:
    710
    Digital Goods:
    29
    #3
    Use both... [L,R=301] [L] just means it's the last one, so it can stop looking for more rewrite rules if one matches that one.
     
    digitalpoint, Jul 27, 2005 IP
  4. just-4-teens

    just-4-teens Peon

    Messages:
    3,968
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ok so i was wrong - sorry
     
    just-4-teens, Jul 27, 2005 IP
  5. just-4-teens

    just-4-teens Peon

    Messages:
    3,968
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #5
    just-4-teens, Jul 27, 2005 IP
  6. Dejavu

    Dejavu Peon

    Messages:
    917
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Ok [L] is simply an optimization, and [R=301] means it is a permanent redirect.
    But what if I didnt specify the [R=301]? Does it return some type of other response code?
    Is is really better from a search engine perspective include the [R=301] part? (From a users perspective there is no difference that I can see)
     
    Dejavu, Jul 27, 2005 IP
  7. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,297
    Likes Received:
    2,602
    Best Answers:
    461
    Trophy Points:
    710
    Digital Goods:
    29
    #7
    If you just do [R] (no 301) it defaults to a 302 (temporary).
     
    digitalpoint, Jul 27, 2005 IP
  8. Dejavu

    Dejavu Peon

    Messages:
    917
    Likes Received:
    53
    Best Answers:
    0
    Trophy Points:
    0
    #8
    It appears to me if I use a 301 redirect, the new url becomes visible in the browser url bar..(not what I want)
    If I wish to use mod_rewrite to make the urls shorter, shoult I then use a 302 redirect? I am really confused now.
     
    Dejavu, Jul 27, 2005 IP
  9. Liminal

    Liminal Peon

    Messages:
    1,279
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #9
    You don't need R at all. From what I understand, all you are after is SE-friendly urls which is what mod_rewrite can be used for without R directive. You'd use redirects (301 or 302) only if your pages actually changed locations and you needed to inform the search engines and site users about the change.
     
    Liminal, Jul 31, 2005 IP