Jump to content

Getting Googlebot To Index Your Phpbb Forums


leezard

Recommended Posts

Been doing some digging and found this "hack" you can use with phpbb to get googlebot to index you phpbb. I put it on my site about 2 weeks ago, and it seems to be working, theres a couple of my forum topics and threads on google now.

 

>##############################################################
## MOD Title: enhance-google-indexing
## MOD Author: Showscout & R. U. Serious
## MOD Description: If the User_agent includes the string 'Googlebot', then no session_ids are appended to links, which will (hopefully) allow google to index more than just your index-site.
## MOD Version: 0.9.1
##
## Installation Level: easy
## Installation Time: 2 Minutes
## Files To Edit: includes/sessions.php
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Author Notes: There may be issues with register globals on newer
##       PHP version. If you know for sure and also how to fix it post in
##       this thread: http://www.phpbb.com/phpBB/viewtopic.php?t=32328
##
##       Obviously, if someone thinks it's funny to surf around with a
##       user_agent containing Googlebot and at the same time does not
##       allow cookies, he will loose his session/login on every pageview.
##       Should he complain to you, tell him to eat your shorts.
##
##       If you want to add further crawlers look at the appropiate line and
##       feel free to add part of the user_agent which should be _unique_
##       unique to that, so a user is never confused with a bot.
##
##############################################################
## Version History: 0.9.0 initial release, only googlebot
##                         0.9.1 added inktomi (MSN-search/crawler-bot)
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#-----[ OPEN  ]------------------------------------------
includes/sessions.php

#-----[ FIND ]------------------------------------------
  global $SID;

  if ( !empty($SID) && !eregi('sid=', $url) )

#-----[ REPLACE WITH ]------------------------------------------
  global $SID, $HTTP_SERVER_VARS;

  if ( !empty($SID) && !eregi('sid=', $url) && !strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Googlebot') && !strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'slurp@inktomi.com;'))

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

 

And this one will prevent googlebot from appearing mutiple times in your who's online list

 

>#################################################################
## MOD Title: GoogleSingleSession (Add-On to enhance-google-indexing )
## MOD Author: - R. U. Serious
## MOD Description: This MOD will give all 'guests' where the useragent
##          contains 'Googlebot' one session (static session_id)
##          Hence it will only appear as a single guest.
##
## MOD Version: 0.9
##
## Installation Level: (easy)
## Installation Time: 5 Minutes
## Files To Edit: includes/sessions.php 
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Author Notes: This is only an Add-ON. You will not notice anything with only this mod
##       installed. Please consider installing another MOD to enhance Google-indexing
##       http://www.phpbb.com/phpBB/viewtopic.php?p=193214#193214
##       ( enhance-google-indexing )
##############################################################

#-----[ OPEN ]------------------------------------------
#
includes/sessions.php

#
#-----[ FIND ]------------------------------------------
#
$session_id = md5(uniqid($user_ip));

#
#-----[ REPLACE WITH ]------------------------------------------
#
# Note: d8ef2eab is one of the googlecrawlbots ips
#
//$session_id = md5(uniqid($user_ip));
global $HTTP_SERVER_VARS;
$session_id = ( !strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Googlebot') ) ? md5(uniqid($user_ip)) : md5(d8ef2eab);


#
#-----[ FIND ]------------------------------------------
#
  else
  {
     $sessiondata = '';
     $session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : '';
     $sessionmethod = SESSION_METHOD_GET;
  }


#
#-----[ AFTER ADD ]------------------------------------------
#
  global $HTTP_SERVER_VARS;
  if ( empty($session_id)  && strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Googlebot') )
  {
     $sessiondata = '';
     $session_id = md5(d8ef2eab);
     $sessionmethod = SESSION_METHOD_GET;
  }


#
#-----[ FIND ]------------------------------------------
#

        if ( $ip_check_s == $ip_check_u )

#
#-----[ REPLACE WITH ]------------------------------------------
#

  //      if ( $ip_check_s == $ip_check_u )
        if (( $ip_check_s == $ip_check_u ) || ($session_id == md5(d8ef2eab)&&(strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Googlebot'))))

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...