PHPSESSID, Googlebot and .htaccess

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Googlebot has been picking up numerous PHPSESSID name/value pairs in  
URIs at my website, and this causes duplicate hits and wasted bandwidth.  
  I've since prevented PHPSESSID generation in my PHP script if  
Googlebot makes the request; like so:

    if(preg_match("/googlebot/i", $_SERVER['HTTP_USER_AGENT']) != 1)
    //session code here

...but this doesn't stop the PHPSESSID requests from Googlebot because  
they're already stored in its database, and it continues to request  
query strings like this one:


Therefore, I'd like to use modrewrite (in .htaccess) to permanently  
redirect to the same page after stripping out the PHPSESSID name/value  
pair..but I'm having great difficult in figuring out how to do this.  (I  
can strip it if it's the only name/value in the query_string, but not if  
there are other name/values in there, as in the example above.)  I now  
wonder if it's even possible.

Yep, I've Googled exhaustively and you're better than me if you can find  
a solution that way.

Site Timeline