On Gear Live: Apple purchases Beats Electronics & Beats Music for $3 billion, Dr. Dre & Jimmy Iovine join company

Latest Gear Live Videos

Tuesday June 7, 2005 8:03 pm

Get Your phpBB Forums Indexed




Posted by Andru Edwards Categories: Design, Marketing

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

Post a Comment:







Smileys

Remember my personal information

Notify me of follow-up comments?



Advertisement