Webmedic SEO mod with phpbbFetchAll

Discussions and support about the different URL Rewriting techniques for phpBB2.

Moderator: Moderators

Webmedic SEO mod with phpbbFetchAll

Postby mreider » Sun May 07, 2006 3:14 pm

Any chance of getting the mod rewrites to work with phpbbfetchall?

For example on the front page of my site I use fetchall to pull the latest posts and display them. However they appear as viewtopic.php. The links work of course, but I don't want google spidered the same page with two different URLs, the keyword url which appears in the forum, and the viewtopic.php that fetchall spits out.

Is there a way to re-write the link produced by fetchall to be the same as in the forum?
mreider
phpBB SEO Team
phpBB SEO Team
 
Posts: 292
Joined: Sun May 07, 2006 3:11 pm

Advertisement

Postby hedgehog » Sun May 07, 2006 6:46 pm

You could probably restrict the file.php files with the robots.txt file

Maybe add this to the robots.txt
Code: Select all
Disallow: /viewtopic.php?

or maybe this depending on how you installed your phpbb
Code: Select all
Disallow: /phpbbinstall/viewtopic.php?


You can test your robots.txt with google sitemaps to make sure it is working. I usually do this after I change the my robots.txt


Cheers

DCZ might have a better idea, but this is what I do ;) I use the topicsanywhere mod, and i haven't had a problem doing it this way
hedgehog
 
Posts: 15
Joined: Sat Apr 29, 2006 10:12 pm

Postby mreider » Mon May 08, 2006 8:51 am

Good call! What I did in the meantime is added the rel="nofollow" to each of the viewtopic links. But I guess adding it in robots.txt would be an extra level of protection.
mreider
phpBB SEO Team
phpBB SEO Team
 
Posts: 292
Joined: Sun May 07, 2006 3:11 pm

Postby dcz » Mon May 08, 2006 5:41 pm

But the best is to make phpBB Fectch all to use the same url standard.

And we want the best here ;)

PhpBB Fetch all is widely used, and even though I do not consider it as the best possible solution, it's very handy and works very well. So I think it would be a good thing to issue an add on for it.

If you have a link to the thread where it is being dev, please post it, and I'll issue a patch. Should not be that hard.

By the way welcome ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby mreider » Mon May 08, 2006 5:44 pm

Sadly, I don't think anyone's working on a solution right now.

I played around with my .htaccess to see if I could re-write the URLS but that made a mess :)

I think it should be easy. I mean fetchall basically grabs the data from the forum database, such as the topic title. The trick would then be getting it to output the topic title in the link, in the same format as the webmedic keywords url mod.

What do you think?
mreider
phpBB SEO Team
phpBB SEO Team
 
Posts: 292
Joined: Sun May 07, 2006 3:11 pm

Postby dcz » Mon May 08, 2006 9:11 pm

hehe

If you have a link to the thread where it is being dev, please post it, and I'll issue a patch. Should not be that hard.


I meant it, I was just too lazy :D to find the link to the thread where this mod is being dev to download it and see how it work a bit. I am pretty sure that a patch is possible.

Cause you have to change the way the url are build in the php code before an .htaccess file with rewriterules can be useful.

So I think, please post the link, I am sure a patch would be useful to quite some, so this is the project here :D
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby mreider » Tue May 09, 2006 8:08 am

I'm not sure the thread where phpbbfetchall is being developed, but they have their own website - http://www.phpbbfetchall.com
mreider
phpBB SEO Team
phpBB SEO Team
 
Posts: 292
Joined: Sun May 07, 2006 3:11 pm

Postby dcz » Tue May 09, 2006 8:38 am

Okay, lol, could have found this one ;)

So, I had a brief look up of the phpBB Fecht all script, and it is quite strange it is not using the append_sid function in its functions.
And if I get it well, this script is meant to be customised by users.

So in the end the changes to make could be different for different set up.

So for the released portal.php in the example folder of the 2.0.15 release, try this :

Open :

example/portal.php

Find :

Code: Select all
<?php $last_cat = $forums[$i]['cat_id']; ?>
  <tr>
    <td class="catLeft" colspan="3" height="28"><span class="cattitle"><a href="<?php echo append_sid($phpbb_root_path . 'index.php?c=' . $forums[$i]['cat_id']); ?>" class="cattitle"><?php echo $forums[$i]['cat_title']; ?></a></span></td>
  </tr>
<?php } ?>


Replace with :

Code: Select all
<?php $last_cat = $forums[$i]['cat_id']; ?>
  <tr>
    <td class="catLeft" colspan="3" height="28"><span class="cattitle"><a href="<?php echo append_sid($phpbb_root_path . make_url_friendly($forums[$i]['cat_title']) . '-vc' . $forums[$i]['cat_id']); ?>" class="cattitle"><?php echo $forums[$i]['cat_title']; ?></a></span></td>
  </tr>
<?php } ?>


Find :

Code: Select all
  <tr>
    <td class="row1" align="left" width="100%">
      <span class="forumlink">
      <a href="<?php echo append_sid($phpbb_root_path . 'viewforum.php?f=' . $forums[$i]['forum_id']); ?>" class="forumlink"><?php echo $forums[$i]['forum_name']; ?></a><br />


Replace with :
Code: Select all
  <tr>
    <td class="row1" align="left" width="100%">
      <span class="forumlink">
      <a href="<?php echo append_sid($phpbb_root_path . make_url_friendly($forums[$i]['forum_name']) . '-vf' . $forums[$i]['forum_id']); ?>" class="forumlink"><?php echo $forums[$i]['forum_name']; ?></a><br />
      </span>



Find :

Code: Select all
      <span class="gensmall">
<div align="right"><font color="#333333" face="Verdana" size="1">(<?php echo $news[$i]['topic_replies']; ?>)
<a href="<?php echo append_sid($phpbb_root_path . 'viewtopic.php?t=' . $news[$i]['topic_id']); ?>">
<?php echo $lang['Replies']; ?></a></font></div>


Replace with :

Code: Select all
      <span class="gensmall">
<div align="right"><font color="#333333" face="Verdana" size="1">(<?php echo $news[$i]['topic_replies']; ?>)
<a href="<?php echo append_sid($phpbb_root_path . make_url_friendly($news[$i]['topic_title']) . '-vt' . $news[$i]['topic_id']); ?>">
<?php echo $lang['Replies']; ?></a></font></div>


Then, there is the last post link being a duplicate since it's a viewtopic.php?p= link, so it's a duplicate, you may just do nothing about it a leae it unallowed by the robots.txt.

Code: Select all
Disallow: /path/viewtopic.php


This rule should be in there anyway.

So this should do the trick.

Note : You have to be running the last updated version of the webmedic mode (2.3.1) to use this patch (the main difference with previous version is the make_url_friendly() code to have been moved to function.php, allowing it to be used anywhere in phpBB pages.

Tell me if you encounter problems.

I'd appreciate a link to see the result ;) and will issue a patch for the phpBB SEO mod rewrites as well.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby mreider » Tue May 09, 2006 8:55 am

That was quick! We're definitely on the right track.

When I go to the portal.php in the example it works perfectly.

But the way I'm using fetchall is to grab data from the forum and display it on non forum pages, like the index.php in the root of my site.

In order to do that, at the very beginning of my index.php I have this to connect to phpbb:

Code: Select all
<? $phpbb_root_path = '/home/usr/public_html/forums/'; define ('IN_PHPBB', true); if (!file_exists($phpbb_root_path . 'extension.inc')) { die ('<tt><b>phpBB Fetch All:</b> $phpbb_root_path is wrong and does not point to your forum.</tt>'); } include_once ($phpbb_root_path . 'extension.inc'); include_once ($phpbb_root_path . 'common.' . $phpEx); include_once ($phpbb_root_path . 'includes/bbcode.' . $phpEx); include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/common.' . $phpEx); include_once ($phpbb_root_path . 'mods/phpbb_fetch_all/posts.' . $phpEx); // Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);$CFG['posts_trim_topic_number'] = 25; $recent = phpbb_fetch_posts(null, POSTS_FETCH_LAST); $CFG['posts_trim_topic_number'] = 0; $CFG['posts_span_pages'] = true; $news = phpbb_fetch_posts(); phpbb_disconnect(); ?>



That grabs the data (latest posts, their titles, posters, etc).

Then to display that info on the page I use the following:

Code: Select all
        <? if (isset($recent)) { ?>
        <? echo $lang['Topics']; ?>
        <? for ($i = 0; $i < count($recent); $i++) { ?>
        <? echo create_date($board_config['default_dateformat'], $recent[$i]['post_time'], $board_config['board_timezone']); ?> <a href="<? echo append_sid('http://www.site.com/forums/profile.php?mode=viewprofile&amp;u=' . $recent[$i]['user_id']); ?>"><? echo $recent[$i]['username']; ?></a><br />
        <img src="http://www.site.com/forums/templates/subSilver/images/icon_latest_reply.gif" align="absmiddle" /> <a rel="nofollow" href="<? echo append_sid('http://www.site.com/forums/viewtopic.php?p=' . $recent[$i]['post_id'] . '#' . $recent[$i]['post_id']); ?>"><strong><? echo $recent[$i]['topic_title']; ?>
        <? if ($recent[$i]['topic_trimmed']) { echo '...'; } ?>
        </strong></a><br />
        <? } ?>
        <? } ?></div>


So in short - Your code works beautifully! Now we just need to figure out how to port it so it works on all parts of the site.

My .htaccess with the re-writes is located not in my root, but in my /forums/ folder (in case that's relevant). I've moved it to the root before to see if that made a difference, but it doesn't.

I think the issue is in the link code itself when I display the info from phpbb, example:
Code: Select all
<a rel="nofollow" href="<? echo append_sid('http://www.site.com/forums/viewtopic.php?p=' . $recent[$i]['post_id'] . '#' . $recent[$i]['post_id']); ?>">
because that says viewtopic.php?p=. We need to re-write that to the topic title.

We're close!
mreider
phpBB SEO Team
phpBB SEO Team
 
Posts: 292
Joined: Sun May 07, 2006 3:11 pm

Postby mreider » Tue May 09, 2006 9:32 am

lol - I just realized that's exactly what your code does, I just need to hack it into my index.php.

I'm gonna try that and let you know what I work out :)
mreider
phpBB SEO Team
phpBB SEO Team
 
Posts: 292
Joined: Sun May 07, 2006 3:11 pm

Postby mreider » Tue May 09, 2006 9:39 am

So...Close....!

One thing to note when doing this is you have to define after how many charcters it trims the title - On longer titles you may get the url cut off, and so you'll get a 404. So just set the
Code: Select all
$CFG['posts_trim_topic_number'] = 25;


to something really high, like 150. That solved that problem.

Now there's one last issue. The number after vt- is incorrect!

For example the URL that ends with -vt1028.html, when displayed through fetchall, is showing this extension: -vt3794.html. So I'm getting 404's.

I'll keep looking around the code..
mreider
phpBB SEO Team
phpBB SEO Team
 
Posts: 292
Joined: Sun May 07, 2006 3:11 pm

Postby mreider » Tue May 09, 2006 9:47 am

Ha! I figured it out easy enough.

The reason I was getting a different different numbers after the -vt was because I was grabbing the POST_ID instead of the TOPIC_ID.

Here's the final code I use to pull the data:

Code: Select all
<a href="http://www.mysite.com/forums/<?php echo append_sid(make_url_friendly($recent[$i]['topic_title']) . '-vt' . $recent[$i]['topic_id']); ?>.html">


That produces a link to the topic, keyword friendly and all :)

I think we've got a solution - You should definitely include this in the next release of the mod for everyone using fetchall! I've been wanting to get this working ever since I installed the keywords mod from webmedic like a year ago. Great that it's finally working!
mreider
phpBB SEO Team
phpBB SEO Team
 
Posts: 292
Joined: Sun May 07, 2006 3:11 pm

Postby dcz » Tue May 09, 2006 9:53 am

I think your last problem comes from the fact you are using a post id to create a topic link, eg you are doing this : viewtopic.php?p=post_id => viewtopic.php?t=post_id and for sure it won't work.

You can inject titles and keep '-vp' instead of '-vt', but as previously said, they are duplicates so, you'd rather save some resources and just leave them as they are.

It seemed to me that the phpbbfecth all code was able to output last active threads instead of last post, which seemed to be what I changed in the portal.php example file.

So maybe you could just output topic links instead this way and then have the proper url in the end.
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Postby mreider » Tue May 09, 2006 2:00 pm

Yep - see my previous post :)
mreider
phpBB SEO Team
phpBB SEO Team
 
Posts: 292
Joined: Sun May 07, 2006 3:11 pm

Postby dcz » Wed May 10, 2006 8:21 am

Lol, we posted so close in time I did not noticed ;)

And yes a patch is cool, but, since this mod is very customisable, I am not sure we'll be able to issue more than examples and methods.

Anyway, make sure now your get rid of the rel="nofollow" in those links ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21238
Joined: Fri Apr 28, 2006 9:03 pm

Next

Return to phpBB2 mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: VoilaBot [Bot] and 2 guests