SEO | Link Popularity | Search Engine Consulting | SEO Tutorial | SEO Tools | SEO Forum
Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-04-2004, 03:32 PM
Pyrrhonist Pyrrhonist is offline
Uber Mod
 
Join Date: Jan 2004
Posts: 681 Pyrrhonist has a spectacular aura aboutPyrrhonist has a spectacular aura aboutPyrrhonist has a spectacular aura about
Send a message via ICQ to Pyrrhonist
Modding phpBB to be Search Engine Friendly

Hello everyone.

Ok, here's the accumulation of all the tricks that I picked up while making the SEO guy board search engine friendly before we switched to vBulletin. It was compiled from posts located on the phpBB official forums, and I definitely need to give props to Jaffry over at the phpBB forum who made this up the first place.

The first thing that needs to be done is to make the sid that gets appended to either disappear or look the same to spiders every time they come through the forum. I found 2 ways of doing this:

1) Make the append_sid function in includes/sessions.php show the same sid to the spider every time they float through.

i) Open /includes/sessions.php
ii) Locate the append_sid function (it's the last one)
iii) Replace:
Code:
global $SID;

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


with:

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


Save and close the sessions.php file. I had difficulties getting this to work properly, which is why I tried the next two methods as well. This is by far the most elegant method though, and the one that I would recommend to you to try first. ONLY attempt the next two options if this doesn't work.

The other way of accomplishing the same thing is to just delete all the content from append_sid except for the return line. If you do this, you are guaranteed to never have a sid again. When I tried this however, I encountered problems with the administration area, and tracked them back to the lack of SID.

The third solution is a brute force attack. This involves find/replacing every instance of append_sid() in the main phpBB folder and deleting it. If you manage to catch them all, it pretty much accomplishes the same goal as removing the append_sid() function, but the admin area will still work.

This isn't the most elegant method by any means, and I laugh at myself now when i think that I actually tried it, but it DID work... Attempt at your own risk.

The other major mod is to make the forum itself searchable. I'll get to that next time.
Reply With Quote
  #2  
Old 03-04-2004, 03:58 PM
Pyrrhonist Pyrrhonist is offline
Uber Mod
 
Join Date: Jan 2004
Posts: 681 Pyrrhonist has a spectacular aura aboutPyrrhonist has a spectacular aura aboutPyrrhonist has a spectacular aura about
Send a message via ICQ to Pyrrhonist
Ok. Now, to make the threads themselves searchable, we use mod_rewrite if you are using Apache for your webserver, or you can perform an ASAPI_rewrite if you're on an IIS box. I don't know ASAPI, and we use Apache anyways, so that's what my example is meant for.

Feel free to post the matching file for IIS, or I'll try to get to it sometime in the future.

Ok, to make the posts searchable, first open up /includes/page_header.php and add the following code where it reads
Code:
//
// Generate logged in/logged out status
//

ob_start();


Make sure there are no spaces at the line ends after it's pasted

Code:
function replace_for_mod_rewrite(&$s) { 
$urlin = array( 
    "'(?<!/)viewforum.php\?f=([0-9]*)&topicdays=([0-9]*)&start=([0-9]*)'", 
    "'(?<!/)viewforum.php\?f=([0-9]*)&mark=topics'", 
    "'(?<!/)viewforum.php\?f=([0-9]*)'", 
    "'(?<!/)viewtopic.php\?t=([0-9]*)&view=previous'", 
    "'(?<!/)viewtopic.php\?t=([0-9]*)&view=next'", 
    "'(?<!/)viewtopic.php\?t=([0-9]*)&postdays=([0-9]*)&postorder=([a-zA-Z]*) &start=([0-9]*)'", 
    "'(?<!/)viewtopic.php\?t=([0-9]*)&start=([0-9]*)&postdays=([0-9]*)&postorder=([a-zA-Z]*)&highlight=([a-zA-Z0-9]*)'", 
    "'(?<!/)viewtopic.php\?t=([0-9]*)&start=([0-9]*)'", 
    "'(?<!/)viewtopic.php\?t=([0-9]*)'", 
    "'(?<!/)viewtopic.php&p=([0-9]*)'", 
    "'(?<!/)viewtopic.php\?p=([0-9]*)'", 
); 

$urlout = array( 
    "viewforum\\1-\\2-\\3.html", 
    "forum\\1.html", 
    "forum\\1.html", 
    "ptopic\\1.html", 
    "ntopic\\1.html", 
    "ftopic\\1-\\2-\\3-\\4.html", 
    "ftopic\\1.html", 
    "ftopic\\1-\\2.html", 
    "ftopic\\1.html", 
    "sutra\\1.html", 
    "sutra\\1.html", 
); 

$s = preg_replace($urlin, $urlout, $s); 

return $s; 
} 


In /includes/page_tail.php, after
Code:
$db->sql_close();

Add this:
Code:
$contents = ob_get_contents();
ob_end_clean();
echo replace_for_mod_rewrite($contents);
global $dbg_starttime;


In the same file, (/includes/page_tail.php) after:
Code:
ob_end_clean();


Add this:
Code:
echo replace_for_mod_rewrite($contents);
global $dbg_starttime;


The last thing to change is your .htaccess file (for Apache servers). The .htaccess file is a system file for Apache, and the . in front of it makes it invisible to many via ftp. Please ensure that there isn't already a .htaccess present. It is used for much more than just rewriting urls and can have some pretty catastrophic effects on your site if you don't preserve its contents.

Code:
# .htaccess.  Add the new code at the bottom of the .htaccess file.
# Do NOT overwrite file without backing up.  

RewriteEngine On 

RewriteRule ^forums.* index.php 
RewriteRule ^forum([0-9]*).* viewforum.php?f=$1&mark=topic 
RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).* viewforum.php?f=$1&topicdays=$2&start=$3 
RewriteRule ^forum([0-9]*).* viewforum.php?f=$1 
RewriteRule ^ptopic([0-9]*).* viewtopic.php?t=$1&view=previous 
RewriteRule ^ntopic([0-9]*).* viewtopic.php?t=$1&view=next 
RewriteRule ^ftopic([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).* viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4 
RewriteRule ^ftopic([0-9]*)-([0-9]*).* viewtopic.php?t=$1&start=$2 
RewriteRule ^ftopic([0-9]*).* viewtopic.php?t=$1 
RewriteRule ^ftopic([0-9]*).html viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5 
RewriteRule ^sutra([0-9]*).* viewtopic.php?p=$1 


If your forum is part of a subdomain, then the above file may not work for you. In that case, try this one:

Code:
RewriteEngine On 

RewriteRule ^forums.* /index.php 
RewriteRule ^forum([0-9]*).* /viewforum.php?f=$1&mark=topic 
RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).* /viewforum.php?f=$1&topicdays=$2&start=$3 
RewriteRule ^forum([0-9]*).* /viewforum.php?f=$1 
RewriteRule ^ptopic([0-9]*).* /viewtopic.php?t=$1&view=previous 
RewriteRule ^ntopic([0-9]*).* /viewtopic.php?t=$1&view=next 
RewriteRule ^ftopic([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).* /viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4 
RewriteRule ^ftopic([0-9]*)-([0-9]*).* /viewtopic.php?t=$1&start=$2 
RewriteRule ^ftopic([0-9]*).* /viewtopic.php?t=$1 
RewriteRule ^ftopic([0-9]*).html /viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5 
RewriteRule ^sutra([0-9]*).* /viewtopic.php?p=$1 


Remember, in your robots.txt file, you should add the following lines to prevent several files from getting spidered. This is done to prevent the feeding of duplicate content to Google.

Code:
Disallow: /your-forum-folder/sutra*.html$ 
Disallow: /your-forum-folder/ptopic*.html$ 
Disallow: /your-forum-folder/ntopic*.html$ 
Disallow: /your-forum-folder/ftopic*asc*.html$ 


Ok, that's it. Again, thanks to Jaffrey at the phpBB forums for compiling this original post.
Reply With Quote
  #3  
Old 04-27-2004, 08:53 AM
bigboy bigboy is offline
SEO Junior
 
Join Date: Apr 2004
Posts: 1 bigboy is on a distinguished road
Hello SEO BOB,
I did every thing as per above post but my board page is coming blank !!!
Do you have any idea ?

P.S I check my PHP info that mod_rewrite is enabled
Reply With Quote
  #4  
Old 04-27-2004, 09:09 AM
Pyrrhonist Pyrrhonist is offline
Uber Mod
 
Join Date: Jan 2004
Posts: 681 Pyrrhonist has a spectacular aura aboutPyrrhonist has a spectacular aura aboutPyrrhonist has a spectacular aura about
Send a message via ICQ to Pyrrhonist
Bigboy,

welcome to the forum,

What's your forum's url? I would like to take a look at it before making any comments.
__________________
SEO Tutorial
Bob's quote of the week:
SEO Bob: "world cup of hockey is starting isn't it [, Dilligaf]? Who are you cheering for dilli?"
Dilligaf: "Well... if you promise not to tell my neighbours... "Oh Canada... ""
Reply With Quote
  #5  
Old 05-16-2004, 07:33 AM
complainer complainer is offline
SEO Junior and a half
 
Join Date: May 2004
Posts: 94 complainer is on a distinguished road
Quote:
Originally Posted by SEO Bob
The first thing that needs to be done is to make the sid that gets appended to either disappear or look the same to spiders every time they come through the forum. I found 2 ways of doing this:

1) Make the append_sid function in includes/sessions.php show the same sid to the spider every time they float through.


Hello and thank you! I've had a phpbb forum for some time now. I didn't realize how easy it was to make it spider-able until I saw your post. I followed your first step and here it is a week later and I see Googlebot munching on my forum pages.

I haven't braved the "make the threads searchable" modification yet, but I'll report back if and when I do.
Reply With Quote
  #6  
Old 05-16-2004, 07:39 AM
jocelyn's Avatar
jocelyn jocelyn is offline
Moderator
 
Join Date: Mar 2004
Location: Montréal / Canada
Posts: 5,155 jocelyn has a spectacular aura aboutjocelyn has a spectacular aura aboutjocelyn has a spectacular aura about
Welcome to the forum Complainer
Nice to see you here.
Reply With Quote
  #7  
Old 05-16-2004, 07:48 AM
complainer complainer is offline
SEO Junior and a half
 
Join Date: May 2004
Posts: 94 complainer is on a distinguished road
Quote:
Originally Posted by jocelyn
Welcome to the forum Complainer
Nice to see you here.

Thanks, it's like walking into a room filled with old friends.
Reply With Quote
  #8  
Old 05-16-2004, 07:53 AM
jocelyn's Avatar
jocelyn jocelyn is offline
Moderator
 
Join Date: Mar 2004
Location: Montréal / Canada
Posts: 5,155 jocelyn has a spectacular aura aboutjocelyn has a spectacular aura aboutjocelyn has a spectacular aura about
Quote:
Originally Posted by complainer
Thanks, it's like walking into a room filled with old friends.

Yes... and most of us found the forum on Google...
SEO GUY is not using other forums to promote his.

Did you find it on google ?
Reply With Quote
  #9  
Old 05-16-2004, 05:11 PM
seo guy's Avatar
seo guy seo guy is offline
Uber Uber Mod
 
Join Date: Oct 2003
Posts: 2,441 seo guy has much to be proud ofseo guy has much to be proud ofseo guy has much to be proud ofseo guy has much to be proud ofseo guy has much to be proud ofseo guy has much to be proud ofseo guy has much to be proud ofseo guy has much to be proud of
Yeah Im not huge fan of flaming, I do have it in my sig on some other forums but I try not to mention it or promote it when speaking elsewhere, kind of cheesy if you ask me. MIND YOU IF YOU GUYS WANNA SPAM FOR ME >>>>>> LOL JK
Welcome Aboard complainer
__________________
Vote for your favorite SEO site and tell your visitors about this great place, please link to us http://www.seo-guy.com with the anchor text SEO and let them know how you feel
Reply With Quote
  #10  
Old 05-17-2004, 12:04 AM
eCommando eCommando is offline
Premium member
 
Join Date: Apr 2004
Posts: 366 eCommando is on a distinguished road
Why switch to vBulletin from phpBB? Are there advantages?
I am interested in getting more info on the forum software.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Login/Register
User Name
Password
Remember Me?

Forum Links
Forum Home
SEO Forum
Internet Marketing Forum
Web Design Forum
Web Hosting Forum
Programming Forum
SEO Chat

Quick Links
Forum Home
New Posts
Mark Forums Read
Open Buddy List
User Control Panel
Edit Avatar
Edit Profile
Edit Options
Miscellaneous
Subscribed Threads
My Profile

Search Forums

Advanced Search
All times are GMT -8. The time now is 09:52 PM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.