Which one is correct (2 .htaccess redirect rules) ?

Discussion in 'Apache' started by MyArtGallery, Feb 16, 2012.

  1. #1
    Hi

    Can anyone tell me which redirect is better?

    Both works (I mean the page is redirected) but I'm not sure which one is the best for google)

    I want to redirect www.mysite.com/gategory_1/$pag=XXX to http://www.mysite.com/ (want to redirect all the xxx pages to homepage)

    Which one is correct?

    A) This use query_string
    ----------------------------------------
    RewriteCond %{QUERY_STRING} ^pag=([0-9]*)$
    RewriteRule . http://www.mysite.com? [R=301]
    --------------------------------------

    b) this use the_request and redirect all the url that containg "page=" inside (which is fine for me but not sure if it's correct for google)
    -------------------------------------------
    RewriteCond %{THE_REQUEST} pag=
    RewriteRule . http://www.mysite.com? [R=301]
    ----------------------------------------------

    Can anyone let me know which one si the correct one? Or none???

    Thank you very much!
     
    MyArtGallery, Feb 16, 2012 IP
  2. BigTim3

    BigTim3 Guest

    Messages:
    266
    Likes Received:
    1
    Best Answers:
    2
    Trophy Points:
    0
    #2
    the first one would be the right one
     
    BigTim3, Feb 16, 2012 IP
  3. MyArtGallery

    MyArtGallery Active Member

    Messages:
    418
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #3
    thank you very much
     
    MyArtGallery, Feb 16, 2012 IP