PHPSESSID, Googlebot and .htaccess

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Smith

    #1

    PHPSESSID, Googlebot and .htaccess

    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_AGEN T']) != 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:

    <hxxp://mysite.com/getdetails.php? personID=I23&tr ee=num1&PHPSESS ID=e0489b957f2d 336974ed7f2d71d b2bab>

    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.
    --
    John
Working...