can not find the "right" redirect code for .htaccess

Discussion in 'Apache' started by hasbehas, Feb 26, 2013.

  1. #1
    For an unknown reason Google is generating url extentions on rich snippet pages.
    the most common one that I get it domain.com/?SD
    I would like to get rid of ?SD and redirect to domain.com or / is enough :)
    Now, I am unable to redirect using htaccess %{QUERY_STRING} , and a few other syntaxes did not work.
    Can any one help ?
     
    Solved! View solution.
    hasbehas, Feb 26, 2013 IP
  2. #2
    Try using something like this:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{QUERY_STRING} ^SD [NC]
    RewriteRule ^(.*)$ /$1? [R=301,L]
    Code (markup):
    That should fix your problem(s).
    Cheers!
     
    pr0t0n, Feb 28, 2013 IP
    hasbehas likes this.
  3. hasbehas

    hasbehas Well-Known Member

    Messages:
    726
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    190
    #3
    Hey man.. That worked like a charm.. 3 weeks of research = 1 question @digitalpoint ...
    Thanks a million.. +1
     
    hasbehas, Mar 1, 2013 IP