Forum Moderators: phranque
There is a thread on phpbb community that runs well over 20 pages discussing this topic, and is very old. An answer is not clear at all even though a lot of people have been asking. There seems to be a lot of speculation and suggestions, but no solid code for PhpBB 2.04. Apparently the mod there was written for an earlier version.
Also, there have been some threads in the past here on webmasterworld regarding flat urls, and removing sessions id's, but nothing recent, and no solid answer. Also, no links that I could find for creating flat urls. I also heard some talk about cloaking to solve this problem?
I know a lot of people have been asking this question all over the place, so I thought I would start a new thread in the hopes that someone can provide some solid answers to this old dilemma. How the heck do you optimize PhpBB 2.04 to index properly w. google? Does anyone have code that works for this, or a URL for a mod that actually functions w/ the latest version?
Any help in this would be greatly appreciated! I have about 8000 messages, and 100's of threads that are relevant to my site, and I would like all these topics\threads indexed in google. There has got to be a way to do this, but since I am not a PHP expert, I am somewhat in the dark. Can someone help?
I myself have implimented this code in all of my phpBB sites and it has been proven to work flawlessly!
This is a followup to the original post, and works w/o causing errors
-----------------------------------------------------
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;'))
-----------------------------------------------------
This is the original code that causes 2 fatal errors when attempting to view the forum
#-----[ OPEN ]------------------------------------------
includes/sessions.php
#-----[ FIND ]------------------------------------------
global $SID;
if (!empty($SID) &&!preg_match('#sid=#', $url) )
#-----[ REPLACE WITH ]------------------------------------------
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/CLOSE ALL FILES ]------------------------------------------
#
# EoM
I got errors when viewing the forum using this code.
Will the code that I added work (the first one seems just a little different, but doesn't cause an error like the latter)? Is this right?
I am planning on starting a forum within the next week. Which forum should i get that google will have no problems with. I have seen many free ones and i would prefer it would be one of them. I just want to make sure google and other SE's will love it.
Also, anyone know any good links that will give me tips about starting a forum and getting it successful?
As far as hbirnbaums' code post, what I can recommend is to post a reply to the thread previously mentioned for the phpBB discussion on google indexability. My code I used, I followed the directions on the site and I had no errors. I see your running Windows w/ php and that I haven't dealt with so I don't know if there are any differences between the php for UNIX but that may be the case or just upgrade/installation issues. Also try this thread on google +phpBB2.0.4 [phpbb.com]
that's the modded session.php code that i use with my phpbb v. 2.0.3. It should also work with 2.0.4. Just replace the last function (append_sid) with by code:
-----------------------------------
function append_sid($url, $non_html_amp = false)
{
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'] ,'FAST-WebCrawler') &&!strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Slurp@inktomi') &&!strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Scooter') &&!strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Firefly'))
{
$url .= ( ( strpos($url, '?')!= false )? ( ( $non_html_amp )? '&' : '&' ) : '?' ) . $SID;
}
return($url);
}
-----------------------------------
You can add more user agents and even ip's if you like.
If you copy code examples from the phpbb support forums and paste it into your php codes be carefull -> remove all possible spaces before each return / line feed! In my case the errors i had were a result of this spaces.
HTH
EliteWeb
I tried the code you were using, and it created errors. Not sure what the problem was, but the forum stopped running. I replaced it w/ the old code (pre-google) and it worked again.
Yidaki
I replaced the last function like you said. Forum seems to be working good; no visible errors. I didn't know that spaces were bad. I am really glad that you mentioned this. I have remvoed all trailing spaces from your code, and so far so good.
It looks like this mod is setup for several search engines besides google; good think. I can't wait for google to spider my forum. I think freshbot will goto town on it.
How high of a pr do I need for google to index the entire forum?