MyBB Community Forums

Full Version: phpbb link conversion
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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,
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);
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
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');
great, i'll try that and get back to you ..

cheers
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
add the following to the top of the original index.php file:

define("IN_MYBB", 1);

make sure it goes inside the <?php

?> tags.
above:
require_once "./global.php";
add:
define('IN_MYBB', 1);
Smile
thanks guys...all sorted Smile
Hmm...I could use this too...thanks.
Pages: 1 2