+ Reply to Thread
Results 1 to 9 of 9

Thread: removing session ID for Googlebot ?

  1. #1
    tiendung619299
    Guest

    removing session ID for Googlebot ?

    20.000 Softwares download here

    php Code:

    if($_SERVER['HTTP_USER_AGENT'] != 'Googlebot'){
    * * session_start();
    * * }

    Would this do the trick ?

  2. #2
    moneyisall91
    Guest

    I don't do any sites that do sessions with php, but I'd assume you have to use a regular expression instead of just 'GoogleBot' because they have different version numbers and the "new" one right?



    something like !~ /googlebot/i



    Just an idea.

  3. #3
    ts3
    Guest

    I think preg_match is what you would use in php, (I'm a perl coder not php)



    edit: try this?


    Code:

    if(preg_match("/googlebot/i", $_SERVER['HTTP_USER_AGENT']) != 1){
    session_start();
    }


  4. #4
    concucu021
    Guest

    Ok, I will check the user agent string with regular expressions then ... thanks.

  5. #5
    qwedcxzas
    Guest

    strpos or strstr would be a lot faster than preg_match:


    Code:

    if( strpos( $_SERVER['HTTP_USER_AGENT'], "Googlebot" ) !== false ) {
    // we've found a googlebot
    }else{
    // session initialization code
    }


  6. #6
    cuongcoils
    Guest


    Quote:








    strpos or strstr would be a lot faster than preg_match:



    I'm just curious, besides the fact that I used a case insensitivity in my reg exp. example, how much faster would strpos be? I'm unsure of how efficient the reg exp engine php is, but it's pretty darn fast in perl it only does what it needs to.



    Having said that I'm not to try to claim it's not faster, I'd just like to hear why.

  7. #7
    xuansonmchb
    Guest

    > I used a case insensitivity in my reg exp

    you can also use stripos or stristr for a case-insensitive search. But why do you need a case/insensitive match? I don't see why G would change the UA from Googlebot to googlebot.



    Why is it faster? Probably because it doesn't have to run the string through a reg. expression parser. How much faster is it? I don't know. Here is a quote from php.net (http://www.php.net/manual/en/function.preg-match.php)


    Quote:







    Tip: Do not use preg_match() if you only want to check if one string is contained in another string. Use strpos() or strstr() instead as they will be faster.



  8. #8
    nhatpham
    Guest

    Yeah the quote is enough to answer my question thanks.



    What I was referring to with the case option was that having already put some code up there that was case insensitive, that it would be slower than something case specific. That's all. The reason I did it in the first place? Habit I guess.

+ Reply to Thread

Similar Threads

  1. Question about Googlebot and getting spidered
    By KinBan in forum Search Engine Optimization - SEO
    Replies: 4
    Last Post: 01-12-2006, 04:40 PM
  2. Session IDs in URL
    By phanha91 in forum Search Engine Optimization - SEO
    Replies: 6
    Last Post: 01-12-2006, 08:50 AM
  3. Getting googlebot on my forum
    By ngoctuanso2bt in forum Search Engine Optimization - SEO
    Replies: 7
    Last Post: 01-31-2005, 06:33 PM
  4. Googlebot visits but still not many pages
    By sieuxaydausa12 in forum Site & Server Administration
    Replies: 1
    Last Post: 09-29-2004, 04:14 PM
  5. GoogleBot Slams My Site
    By bunny81 in forum Site & Server Administration
    Replies: 14
    Last Post: 09-10-2004, 04:33 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts