PHP Session IDs are being indexed. Help get rid of them

Discussion in 'PHP' started by Seobiznezz, May 21, 2006.

  1. #1
    Can someone help???

    I have a site that when search engines come, they are just like a viewer and get a session ID attached to them. They spider the site and that session is indexed as well.

    the queries of how people come to the site are all. www.mysite.com/page1.php?sessionID3498310831jk3jlj308

    What would be better would be www.mysite.com/page1.php

    There is a shopping cart so I need to keep the .php pages.

    I just want to make it so that the Sessionid230834208321. does not show up anymore.
     
    Seobiznezz, May 21, 2006 IP
  2. Hoth

    Hoth Well-Known Member

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #2
    You'll need to find where the script is adding the session id and make it exclude search engine user agents.

    
    $spiders = " google msnbot slurp ";
    if (!strstr($spiders, ' '. $_SERVER["HTTP_USER_AGENT"] .' '))
    {
     session id code
    }
    
    Code (markup):
    You can't remove them for all visitors since the script presumably needs it. I can't tell you where the session is set since I don't know the script.
     
    Hoth, May 22, 2006 IP
  3. Seobiznezz

    Seobiznezz Peon

    Messages:
    496
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    There should be a way to get rid of the session so that they are hidden. Even to the user, they should be able to go throughout the site without session IDs following them.

    I think we are using old PHP coding
     
    Seobiznezz, May 23, 2006 IP
  4. Young Twig

    Young Twig Peon

    Messages:
    27
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If it's showing up like this:
    example.com/?PHPSESSID=0as9fd87as90df6a8s7d6f89asd6f89

    then you can use this:
    ini_set('session.use_trans_sid', false);
    ini_set('url_rewriter.tags','');
    PHP:
    But if not, I assume the script is doing it. That would make things a bit trickier. You'd either have to look through the whole thing or use some type of rewrite.
     
    Young Twig, May 23, 2006 IP
  5. Selkirk

    Selkirk Peon

    Messages:
    93
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can put this in your .htaccess file as well:

    php_flag use_trans_sid off
     
    Selkirk, May 23, 2006 IP
  6. dotcomsdotbiz

    dotcomsdotbiz Banned

    Messages:
    73
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You should not even need to echo the session_id in the url. I would remove the sessionID from all of your links.

    Mike :)
     
    dotcomsdotbiz, May 23, 2006 IP
  7. Seobiznezz

    Seobiznezz Peon

    Messages:
    496
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Ok, I am going to try what Young Twig said.

    Yes, what is happening is the search engines are caching the complete session ID code like this.

    example.com/?PHPSESSID=0as9fd87as90df6a8s7d6f89asd6f89

    It is really bad for SEO, as it causes duplication penalties. Yes, we do need visitors to have a session as they go through the site, but don't need the code to appear.

    Hopefully this code you gave will hide it. It looks poor as well to a visitor and it isn't clean for them and the search engines.

    Just want them and the search engines to go through the whole site like this

    example.com/.php

    example.com/productwidget.php
    example.com/productwidgetlarge.php
     
    Seobiznezz, May 23, 2006 IP
  8. Bartbos

    Bartbos Peon

    Messages:
    29
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yes, it's best to turn session IDs in URLs off, not only for the reasons you described, but also for security, since those session IDs will be sent along in any referrer information.
     
    Bartbos, May 27, 2006 IP