MyBB Community Forums
phpbb link conversion - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Community Archive (https://community.mybb.com/forum-106.html)
+--- Forum: Archived Forums (https://community.mybb.com/forum-143.html)
+---- Forum: Archived Development and Support (https://community.mybb.com/forum-155.html)
+----- Forum: MyBB 1.2 Series (https://community.mybb.com/forum-3.html)
+------ Forum: MyBB 1.2 General Support (https://community.mybb.com/forum-4.html)
+------ Thread: phpbb link conversion (/thread-14341.html)

Pages: 1 2


phpbb link conversion - talisman - 2006-12-05

Hi,

i have a request (which may already have been filled)..

i have imported by phpbb into mybb however any links either within the forum or external to the forum still point to posts and threads using the phpbb url viewtopic, viewforum, viewthread etc obviously these will not be found because the urls have now become showthread, showpost etc etc.

I would like a php file in the root to interprate these requests and translate them into mybb urls and redirect.

I know that smf have these routing files available so it must be achievable (though not for me as i know nothing ).

cheers,


RE: phpbb link conversion - Christian - 2006-12-06

Untested, but should work.

viewforum.php:
<?php
define("IN_MYBB", 1);
require_once "./global.php";
$fid = '1';
if(isset($mybb->input['f']))
{
	$fid = intval($mybb->input['f']);
}
header("Location: ".$mybb->settings['bburl']."/forumdisplay.php?fid=".$fid);

viewtopic.php:
<?php
define("IN_MYBB", 1);
require_once "./global.php";
$tid = '1';
if(isset($mybb->input['t']))
{
	$tid = intval($mybb->input['t']);
}
header("Location: ".$mybb->settings['bburl']."/showthread.php?tid=".$tid);



RE: phpbb link conversion - talisman - 2006-12-06

thanks christian.. so create those two files and put them ion the root of the forum, yea ?

will this cover a direct post link as well ?

cheers


RE: phpbb link conversion - Christian - 2006-12-06

Correct, create the files and upload it to your server. What the code does is, all links going to viewforum.php?f=1. will forward to forumdisplay.php?fid=1 and viewtopic.php?t=1 forwards to showthread.php?tid=1.

Also, I forgot the HTTP status code, add the following before the other header's in the previous codes.
header('HTTP/1.1 301 Moved Permanently');



RE: phpbb link conversion - talisman - 2006-12-06

great, i'll try that and get back to you ..

cheers


RE: phpbb link conversion - talisman - 2006-12-11

hiya, just got round to this christian..

i get an error when i put in the original board url..

Quote:Direct initialization of this file is not allowed.

Please make sure IN_MYBB is defined.

any thoughts..

cheers


RE: phpbb link conversion - Chris W. B. - 2006-12-11

add the following to the top of the original index.php file:

define("IN_MYBB", 1);

make sure it goes inside the <?php

?> tags.


RE: phpbb link conversion - Martin M. - 2006-12-11

above:
require_once "./global.php";
add:
define('IN_MYBB', 1);
Smile


RE: phpbb link conversion - talisman - 2006-12-11

thanks guys...all sorted Smile


RE: phpbb link conversion - labrocca - 2006-12-11

Hmm...I could use this too...thanks.