Latest Gear Live Videos
Tuesday June 7, 2005 11:03 pm
Get Your phpBB Forums Indexed
Check out this cool bit of code that allows message board forums to be spidered by search engines like Google. You see, when the spiders hit a URL that includes a session ID, they turn the other way. The following bit of code removed the session ID when it senses a spider, leaving all the information and textual content there to be picked up. This in turn gets more of your pages picked up. This is especially important for business owners who have support forums - questions and issues you have responded to will now show up in search results. Grab the code after the jump.
So basically, what you want to do is open the file specified, edit the appropriate area, and save:
#—-[ OPEN ]
/includes/sessions.php
#—-[ FIND ]
function append_sid($url, $non_html_amp = false)
{ global $SID;if (!empty($SID) && !preg_match('#sid=#', $url) )
{
$url .= ( ( strpos($url, '?') != false ) ? ( ( $non_html_amp ) ?
'&' : '&' ) : '?' ) . $SID;
}return $url;
}#—-[ CHANGE TO ]
function append_sid($url, $non_html_amp = false)
{ global $SID, $HTTP_SERVER_VARS;$_this_agent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
if (preg_match("/google/i", $_this_agent)) {
return $url;
}if (preg_match(”/slurp/i”, $_this_agent)) {
return $url;
}if (preg_match(”/archive/i”, $_this_agent)) {
return $url;
}if (preg_match(”/crawl/i”, $_this_agent)) {
return $url;
}if (preg_match(”/validator/i”, $_this_agent)) {
return $url;
}if (preg_match(”/robot/i”, $_this_agent)) {
return $url;
}if (preg_match(”/check/i”, $_this_agent)) {
return $url;
}if (!empty($SID) && !preg_match(’#sid=#’, $url) )
{
$url .= ( ( strpos($url, '?') != false ) ? ( (
$non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
}return $url;
}#—-[ SAVE & CLOSE ]
- Related Tags:
Advertisement
Advertisement
Advertisement
© Gear Live Media, LLC. 2007 – User-posted content, unless source is quoted, is licensed under a Creative Commons Public Domain License. Gear Live graphics, logos, designs, page headers, button icons, videos, articles, blogs, forums, scripts and other service names are the trademarks of Gear Live Inc.
Comments: