Forum Moderators: phranque

Message Too Old, No Replies

How do you get rid of those odd characters Yahoo appends to URLs?

         

Marcia

2:59 am on Nov 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can see them in the serps and in the logs/stats. They look like www.example.com/?S=A and?N=A and lots of variations using other letters following the question mark.

There's no way to keep up with all the different variations that turn up, and I've actually seen a site get the index file of a directory cached instead of a page on someone's site.

Is there a way to prevent that from happening, so that any variations will only get picked up and show up as www.example.com/?

It generally happens with /subdirectories/ but I have seen it with a root index page and otherpage.html/?N=M also.

[edited by: Marcia at 3:06 am (utc) on Nov. 19, 2007]

jdMorgan

3:13 am on Nov 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The difficult part isn't the code, but rather, determining when and if to remove the query string. On a static site, it's not a problem. And if it only happens for index URLs that should never have a query string, then it's also not a problem.

The simplest case, for a completely-static site, would be curable with something like this in the top-level .htaccess file:


RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?]*)\?[^\ ]*\ HTTP/
RewriteRule (.*) http://www.example.com/$1? [R=301,L]

But things are rarely simple...

Jim