• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 phpbb import, url redirect

Nudaii

Well-known member
#1
howdy i am just moving a forum from phpbb to xenforo

the old folder was /forum

its doing to be top level now aka domain.com/

what would i need to redirect old urls to new etc?
 

Chris D

XenForo developer
Staff member
#2
I think you need something like this in your .htaccess file:

Code:
RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
RewriteRule ^/forum/viewtopic\.php$ /threads/%2? [L,R=301,NC]
RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
RewriteRule ^/forum/viewforum\.php$ /forums/%1 [L,R=301,NC]
 

Jake Bunce

XenForo moderator
Staff member
#4
There are no phpBB-specific redirect scripts, but I just use these:

http://xenforo.com/community/threads/redirection-scripts-for-vbulletin-3-x.5030/

The basic function of these scripts is to map the old ids to the new ones. They can work with phpBB URLs given appropriate rewrite rules. Here are steps for you:

1) Upload these redirect scripts to your old forum location (the /forum folder):

http://xenforo.com/community/threads/redirection-scripts-for-vbulletin-3-x.5030/

You only need the 301config.php file and the showthread.php file to redirect threads (which are the most important thing).

2) Edit the 301config.php file. Uncomment this line (remove the //) and specify the path to your XF directory:

Code:
//	$fileDir = '/home/username/www/forums';
You may also need to specify the name of the import log table if it's not the default (xf_import_log). It may be named archived_import_log:

Code:
//	define('IMPORT_LOG_TABLE', 'import_log_x');
3) Add these rewrite rules to your .htaccess file in the /forum directory. This is based on previous phpBB imports. I assume your URLs follow the same format:

Code:
RewriteEngine on
 
RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$)
RewriteRule ^viewtopic\.php$ /forum/showthread.php?t=%2 [L,R=301,NC]
If you have trouble with this then I can take a look if you give me FTP access to your server.
 

Jake Bunce

XenForo moderator
Staff member
#5
I think you need something like this in your .htaccess file:

Code:
RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
RewriteRule ^/forum/viewtopic\.php$ /threads/%2? [L,R=301,NC]
RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
RewriteRule ^/forum/viewforum\.php$ /forums/%1 [L,R=301,NC]
That assumes you selected the option during the import to preserve the source ids. Otherwise you need the redirect scripts to map the ids.
 

MagnusB

Well-known member
#7
The redirect only works for certain content (the important ones though, like threads and forums, categories might not redirect properly depending on your setup). Be sure to check off Retain imported content IDs, otherwise it won't work at all.

Mine is:
Code:
        RewriteCond %{QUERY_STRING} (^|&)t=([0-9]+)(&|$) [NC]
        RewriteRule ^viewtopic\.php$ /threads/%2? [L,R=301,NC]
        RewriteCond %{QUERY_STRING} (^|&)p=([0-9]+)(&|$) [NC]
        RewriteRule ^viewtopic\.php$ /posts/%2? [L,R=301,NC]
        RewriteCond %{QUERY_STRING} f=(\d+)$ [NC]
        RewriteRule ^viewforum\.php$ /forums/%1 [L,R=301,NC]
I have added one for posts as well (viewtopic.php?p=xxxx), as phpBB creates quite a few of duplicate URLs.
 

Chris D

XenForo developer
Staff member
#9
No one has ever said XenForo makes rewriting URLs easy :)

XenForo makes a lot of things easier. The process of importing your board is made easier because of the XenForo import scripts.

The URL redirection mentioned in this thread is made possible using mod_rewrite which is a module of Apache - nothing at all to do with XenForo.
 

Chris D

XenForo developer
Staff member
#11
What is it exactly you need help with?

Moving from any forum software to any other forum software is going to be pretty much the same process regardless of the starting software and the resulting software.

So if you were to move from PHPBB to SMF or from vBulletin to PHPBB or any combination, the steps are pretty similar.

Import wise, the functionality is built in and is pretty straight forward.

To then redirect your old URLs to new URLs is also the same regardless of software. It will always require the use of .htaccess and mod rewrite.

But, as daunting as it looks, it's quite easy. In fact, you don't even need to understand it yourself. If you post an example of exactly what you're trying to do I'm sure I or my fellow XenForo'ers will be happy to help :)
 
#12
Thank you for the reply. I'm currently running phpBB 3.x - quite a few links have been posted around so I would ideally like to keep the thread and post links working. I have just closed the phpBB forum and am importing everything into a new XF installation. I've taken a look at the guide above and I think I can do it, although it only mentions threads and not posts but I imagine the process is similar. Can you confirm that at all?

Thanks again for the help and quick reply.

Piers
 

MagnusB

Well-known member
#13
The terminology from phpBB and xF is a bit different. Threads = topics, posts are posts, though threads contain posts, if that makes sense.
 

MagnusB

Well-known member
#16
The code above retains those links, or redirects them. Only thing that isn't working is links to categories, IIRC. The URL structure for phpBB and xF are different, so you need to redirect them some way or another.
 
#17
Thanks, running the importer now. It's best to move over to XF before the forum gets any larger I think. It only has a couple of thousand users at the moment and around 8k posts so hopefully most links should work once I've done the bit above.
 

MagnusB

Well-known member
#18
What does the "Retain content IDs" feature do?
It retains the ID's, so the same threads / posts have the same ID in the different softwares. Basically, in viewtopic.php?f=yyy&t=xxx, yyy is the ID for the forum, xxx is the ID of the topic, a bit simplified.