[Solved]Migrating links from smf to phpbb3-seo

phpBB3 SEO Advanced mod Rewrite support forum.
This mods performs URL rewriting for phpBB, injecting forums and topic titles in their URLs.

Moderator: Moderators


[Solved]Migrating links from smf to phpbb3-seo

Postby mik » Thu Jul 10, 2008 1:25 pm

Hello,
I have a board currently running with smf. I want to switch to phpbb3. Links from smf are different than phpbb ones : I made a bridge (simple php file) between smf links to phpbb links. Everything is running fine. I added the seo on phpbb and everything is running. The server is apache 2 with mod_rewrite (under linux).
Here is a smf link : -http://localhost/forum/index.php/topic,2319.msg111848.html#new
my bridge converts this url into -http://localhost/phpbb/viewtopic.php?f=9&t=2319&st=0&sk=t&sd=a&start=30#p111848

I would like to convert it into -http://localhost/phpbb/amd-remonte-un-peu-t2319-30.html

How can I find the seo url with this url -http://localhost/phpbb/viewtopic.php?f=9&t=2319&st=0&sk=t&sd=a&start=30 ? What methods am I supposed to call in phpbb_seo_class.php to convert the url ?

Thank you ;)
Last edited by mik on Fri Jul 11, 2008 11:24 am, edited 1 time in total.
mik
 
Posts: 6
Joined: Thu Jul 10, 2008 1:08 pm
Location: France

Advertisement

Postby dcz » Thu Jul 10, 2008 1:37 pm

The easiest way to do it would be to just link the smf rewriterules to the phpBB3 files and let the zero duplicate do the rest (with a single HTTP 301 header).
For your topic url example, and assuming that the url is indeed a post url, you should use something like :
Code: Select all
RewriteRule ^index\.php/topic,[0-9]+\.msg([0-9])+\.html$ viewtopic.php?p=$1 [QSA,L,NC]


At the very end of you phpBB3 .htaccess, and set post redirection to at least "Guest" for the zero duplicate mod.

And so on with the other types of URLs ;)
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: 19873
Joined: Fri Apr 28, 2006 9:03 pm

Postby mik » Thu Jul 10, 2008 5:00 pm

Thank you for the answer :D
Where can I find zero duplicate for phpbb3 ? I only find it for phpbb2.
mik
 
Posts: 6
Joined: Thu Jul 10, 2008 1:08 pm
Location: France

Postby dcz » Thu Jul 10, 2008 5:04 pm

here : http://www.phpbb-seo.com/boards/phpbb3- ... t1220.html

Have you seen our SEO premod ?

Can be handy since it includes all our mods at once and we support auto update packages just like phpBB3 does, so it's making it a lot easier for updates.

++
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: 19873
Joined: Fri Apr 28, 2006 9:03 pm

Postby mik » Fri Jul 11, 2008 11:24 am

That's very handy this seo premod :D Now my smf links are redirected correctly :) If someone wants, I can send or post the smf bridge ;)

Keep going on this great work ! Thank you :)
mik
 
Posts: 6
Joined: Thu Jul 10, 2008 1:08 pm
Location: France

Postby dcz » Fri Jul 11, 2008 12:37 pm

You're 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: 19873
Joined: Fri Apr 28, 2006 9:03 pm

Postby hijaj » Wed Jan 21, 2009 1:53 pm

mik wrote: If someone wants, I can send or post the smf bridge ;)

I will be more than happy to have such a bridge
I am totaly losy=t, since I see page rank dropping dow due to old smf urls not found
hijaj
 
Posts: 3
Joined: Thu Jan 15, 2009 7:13 pm

Postby SeO » Wed Jan 21, 2009 2:07 pm

dcz wrote:The easiest way to do it would be to just link the smf rewriterules to the phpBB3 files and let the zero duplicate do the rest (with a single HTTP 301 header).
For your topic url example, and assuming that the url is indeed a post url, you should use something like :
Code: Select all
RewriteRule ^index\.php/topic,[0-9]+\.msg([0-9])+\.html$ viewtopic.php?p=$1 [QSA,L,NC]


At the very end of you phpBB3 .htaccess, and set post redirection to at least "Guest" for the zero duplicate mod.

And so on with the other types of URLs ;)


Have you implemented the required rewriterule to have the zero dupe do it's job for the old smf urls ?
SeO
Admin
Admin
 
Posts: 5983
Joined: Wed Mar 15, 2006 9:41 pm

Postby mik » Fri Jan 23, 2009 5:00 pm

I'll post the script and corresponding htaccess in a 2-3 hours ;)
mik
 
Posts: 6
Joined: Thu Jul 10, 2008 1:08 pm
Location: France

Postby mik » Mon Jan 26, 2009 7:58 am

I'm sorry but there were a big problem in my train station (no trains during 3 hours !) and I forgot to post my work.

Place this script in your forum root : smf2phpbb.php
Code: Select all
<?                                               

//you just need to edit this. The trailing slash is mandatory.
$base = "http://localhost/forum/";

$list = array('t', 'b', 'm', 'o', 'p', 'u');
foreach($list as $element)                 
    $$element = $_GET[$element];           

if(is_numeric($t))
{                 
    include("config.php");
    $link = mysql_connect($dbhost, $dbuser, $dbpasswd);
    mysql_select_db($dbname);                         
                                                       
    $query = "SELECT forum_id FROM `" . $table_prefix . "topics` WHERE topic_id=$t";
    $results = mysql_query($query);                                                 
    $row = mysql_fetch_assoc($results);                                             

    $f = $row['forum_id'];

    $url = $base . "viewtopic.php?f=$f&t=$t";

    if(is_numeric($m))
    {
        $query = "SELECT post_id FROM " . $table_prefix . "posts WHERE topic_id=" . $t . " ORDER BY post_time";
        $results = mysql_query($query);
        $i = 0;
        while($row = mysql_fetch_assoc($results))
        {
            if($row['post_id'] == $m)
                break;
            $i++;
        }


        $start = floor($i/15)*15;
        $url .= "&st=0&sk=t&sd=a&start=" . $start . "#p" . $m;
    }

    if(is_numeric($p))
        $url .= "&start=$p";

}

if(is_numeric($b))
    $url = $base . "viewforum.php?f=$b";

if(is_numeric($u))
    $url = $base . "memberlist.php?mode=viewprofile&u=$u";

if(!empty($url))
{
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: $url");
}

?>


Again in you folder root, append those lines to your .htaccess that comes with phpbb-seo :
Code: Select all
RewriteRule ^index\.php/topic,([0-9]+)\.msg([0-9]+)\.html;?(.*)$  smf2phpbb.php?t=$1&m=$2&o=$3  [L]
RewriteRule ^index\.php/topic,([0-9]+)\.msg([0-9]+)/boardseen\.html;?(.*)$  smf2phpbb.php?t=$1&m=$2&o=$3  [L]
RewriteRule ^index\.php/topic,([0-9]+)\.([0-9]+)\.html;?(.*)$  smf2phpbb.php?t=$1&p=$2&o=$3  [L]
RewriteRule ^index\.php/board,([0-9]+)\.([0-9]+)\.html;?(.*)$  smf2phpbb.php?b=$1  [L]


This solution works but it surely needs improvements (i'm not a url rewriting guru). Don't hesitate to post comments ;)
mik
 
Posts: 6
Joined: Thu Jul 10, 2008 1:08 pm
Location: France

Postby SeO » Mon Jan 26, 2009 9:40 am

dcz wrote:For your topic url example, and assuming that the url is indeed a post url, you should use something like :
Code: Select all
RewriteRule ^index\.php/topic,[0-9]+\.msg([0-9])+\.html$ viewtopic.php?p=$1 [QSA,L,NC]



You'd rather only use rewriterules to directly link the smf url to phpBB ones, because what you do here will use two HTTP 301 redirect to end up with the new rewritten url.

Antother way to do the job with a single redirect (performed by the zero dupe) would be to include the required phpBB script after you'd have manually filled the $_REQUEST array with the proper t, f and p values in your script.

But the rewriterule only trick is simpler, from the data you gave, you should only need :
Code: Select all
RewriteRule ^index\.php/topic,([0-9]+)\.msg([0-9]+)(/boardseen)?\.html  viewtopic.php?t=$1&p=$2 [QSA,L,NC]
RewriteRule ^index\.php/topic,([0-9]+)\.([0-9]+)\.html viewtopic.php?t=$1&start=$2 [QSA,L,NC]
RewriteRule ^index\.php/board,([0-9]+)(\.([0-9]+))?\.html viewforum.php?f=$1&start=$3 [QSA,L,NC]


;)
SeO
Admin
Admin
 
Posts: 5983
Joined: Wed Mar 15, 2006 9:41 pm


Return to Advanced SEO URL

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 7 guests


 
cron