Getting Googlebot To Index Your Phpbb Forums

liunx

Guest
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.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->##############################################################<br />## MOD Title: enhance-google-indexing<br />## MOD Author: Showscout & R. U. Serious<br />## 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.<br />## MOD Version: 0.9.1<br />##<br />## Installation Level: easy<br />## Installation Time: 2 Minutes<br />## Files To Edit: includes/sessions.php<br />## Included Files: n/a<br />##############################################################<br />## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the<br />## latest version of this MOD. Downloading this MOD from other sites could cause malicious code<br />## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered<br />## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/<br />##############################################################<br />## Author Notes: There may be issues with register globals on newer<br />##       PHP version. If you know for sure and also how to fix it post in<br />##       this thread: http://www.phpbb.com/phpBB/viewtopic.php?t=32328<br />##<br />##       Obviously, if someone thinks it's funny to surf around with a<br />##       user_agent containing Googlebot and at the same time does not<br />##       allow cookies, he will loose his session/login on every pageview.<br />##       Should he complain to you, tell him to eat your shorts.<br />##<br />##       If you want to add further crawlers look at the appropiate line and<br />##       feel free to add part of the user_agent which should be _unique_<br />##       unique to that, so a user is never confused with a bot.<br />##<br />##############################################################<br />## Version History: 0.9.0 initial release, only googlebot<br />##                         0.9.1 added inktomi (MSN-search/crawler-bot)<br />##############################################################<br />## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD<br />##############################################################<br /><br />#-----[ OPEN  ]------------------------------------------<br />includes/sessions.php<br /><br />#-----[ FIND ]------------------------------------------<br />   global $SID;<br /><br />   if ( !empty($SID) && !eregi('sid=', $url) )<br /><br />#-----[ REPLACE WITH ]------------------------------------------<br />   global $SID, $HTTP_SERVER_VARS;<br /><br />   if ( !empty($SID) && !eregi('sid=', $url) && !strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Googlebot') && !strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'[email protected];'))<br /><br />#<br />#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------<br />#<br /># EoM<!--c2--></div><!--ec2--><br /><br />And this one will prevent googlebot from appearing mutiple times in your who's online list<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->#################################################################<br />## MOD Title: GoogleSingleSession (Add-On to enhance-google-indexing )<br />## MOD Author: - R. U. Serious<br />## MOD Description: This MOD will give all 'guests' where the useragent<br />##          contains 'Googlebot' one session (static session_id)<br />##          Hence it will only appear as a single guest.<br />##<br />## MOD Version: 0.9<br />##<br />## Installation Level: (easy)<br />## Installation Time: 5 Minutes<br />## Files To Edit: includes/sessions.php <br />##############################################################<br />## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the<br />## latest version of this MOD. Downloading this MOD from other sites could cause malicious code<br />## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered<br />## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/<br />##############################################################<br />## Author Notes: This is only an Add-ON. You will not notice anything with only this mod<br />##       installed. Please consider installing another MOD to enhance Google-indexing<br />##       http://www.phpbb.com/phpBB/viewtopic.php?p=193214#193214<br />##       ( enhance-google-indexing )<br />##############################################################<br /><br />#-----[ OPEN ]------------------------------------------<br />#<br />includes/sessions.php<br /><br />#<br />#-----[ FIND ]------------------------------------------<br />#<br />$session_id = md5(uniqid($user_ip));<br /><br />#<br />#-----[ REPLACE WITH ]------------------------------------------<br />#<br /># Note: d8ef2eab is one of the googlecrawlbots ips<br />#<br />//$session_id = md5(uniqid($user_ip));<br />global $HTTP_SERVER_VARS;<br />$session_id = ( !strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Googlebot') ) ? md5(uniqid($user_ip)) : md5(d8ef2eab);<br /><br /><br />#<br />#-----[ FIND ]------------------------------------------<br />#<br />   else<br />   {<br />      $sessiondata = '';<br />      $session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : '';<br />      $sessionmethod = SESSION_METHOD_GET;<br />   }<br /><br /><br />#<br />#-----[ AFTER ADD ]------------------------------------------<br />#<br />   global $HTTP_SERVER_VARS;<br />   if ( empty($session_id)  && strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Googlebot') )<br />   {<br />      $sessiondata = '';<br />      $session_id = md5(d8ef2eab);<br />      $sessionmethod = SESSION_METHOD_GET;<br />   }<br /><br /><br />#<br />#-----[ FIND ]------------------------------------------<br />#<br /><br />         if ( $ip_check_s == $ip_check_u )<br /><br />#<br />#-----[ REPLACE WITH ]------------------------------------------<br />#<br /><br />   //      if ( $ip_check_s == $ip_check_u )<br />         if (( $ip_check_s == $ip_check_u ) || ($session_id == md5(d8ef2eab)&&(strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Googlebot'))))<br /><br />#<br />#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------<br />#<br /># EoM<!--c2--></div><!--ec2--><!--content-->
leezard,<br /><br />a useful bit of info - thanks Thumbs Up <br /><br />Andy<!--content-->
 
Top