Help with conditional refresh

Discussion in 'General Programming Chat' started by Realign02, May 4, 2010.

Tags:
  1. Realign02

    Realign02 Regular Member

    Joined:
    Aug 13, 2007
    Messages:
    389
    Likes Received:
    232
    Occupation:
    Full time IMER
    Any help with this would be really appreciated.

    I'm advertising with G adwords and my CC processor only allows the URL I submit, so they allow mysite.com/test but G adwords changes it to mysite.com/test/?=45ljlj (Their code)

    Is there a way to setup my page to redirect anything that's added on to the end?

    For example redirect mysite.com/test/(ANYTHING HERE) to mysite.com/test

    Thanks again for the help.
     
  2. Curious George

    Curious George Newbie

    Joined:
    Feb 5, 2009
    Messages:
    34
    Likes Received:
    32
    You should be able to do this with mod_rewrite and your .htaccess file

    A quick search yields this solution, although you should do your own due diligence since i suck at mod_rewrite :D

    Code:
    [B]Removing the Query_String[/B]
    
    On many sites, the page will be displayed for both page.html and page.html?anything=anything, which hurts your SEO with duplicate  content. An easy way to fix this issue is to redirect external requests  containing a query string to the same uri without the query_string.
    
    RewriteCond %{THE_REQUEST} ^GET\ /.*\;.*\ HTTP/
    RewriteCond %{QUERY_STRING} !^$
    RewriteRule .* http://www.askapache.com%{REQUEST_URI}? [R=301,L]
     
    • Thanks Thanks x 1