Redirecting MyBB URL's

m1ne

Well-known member
Hello.

I've not converted my MyBB forum yet, but I know this will be a problem, so I am posting now.
Is there any way to redirect old MyBB url's to XF links? Using htaccess perhaps?
MyBB URL's look like this,

/thread-30028.html
/forum-121.html
/user-2.html

I've got a lot of indexed url's so I hope there's a way to do this.

Thank you.
 
If anyone needs to use the PHP redirect scripts in this thread with XF2, then you need to change the top of each file to initialize everything for XF2.

Old XF1 init:

Rich (BB code):
<?php

$startTime = microtime(true);
$fileDir = dirname(__FILE__);

require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');

XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);

####################

// GET DB
$db = XenForo_Application::get('db');

$_REQUEST['slug'] = (isset($_REQUEST['slug']) ? $_REQUEST['slug'] : '');

...

New XF2 init:

Rich (BB code):
<?php

$dir = __DIR__;
require ($dir . '/src/XF.php');

XF::start($dir);

####################

// GET DB
$db = XF::app()->db();

$_REQUEST['slug'] = (isset($_REQUEST['slug']) ? $_REQUEST['slug'] : '');

...
 
Well...
After reading well this topic. Only editing your httaccess is possible to create the correct redirections.

Thanks A LOT for this. :) It's working in May 2020
 
I've not converted my MyBB forum yet, but I know this will be a problem, so I am posting now.
Is there any way to redirect old MyBB url's to XF links? Using htaccess perhaps?
MyBB URL's look like this,

/thread-30028.html
/forum-121.html
/user-2.html

I've got a lot of indexed url's so I hope there's a way to do this.

Thank you.

I converted the baby forum 3 years ago from mybb. 7-8 months hit loss. It will surely be. If you say security and technology, you have to transform
 
@jmcl07

Place these rules at the top of the .htaccess file in the old /forums directory where MyBB was:

Code:
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|\?)tid=([0-9]+)&pid=([0-9]+)($|&)
RewriteRule ^showthread\.php$ http://community.therealsocom.com/posts/%3/? [R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)tid=([0-9]+)($|&)
RewriteRule ^showthread\.php$ http://community.therealsocom.com/threads/%2/? [R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)action=profile&uid=([0-9]+)($|&)
RewriteRule ^member\.php$ http://community.therealsocom.com/members/%2/? [R=301,L]
For example, I never asked when I was converting. You're lucky.
 
Top Bottom