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

XF 1.4 Questions about SMF import

I'm currently working with a forum that just upgraded from SMF 2.0 to XF 1.4.3. The import came off fine, and all old content is visible within XF.

I'd like to get old link redirection working. The import was done without preserving content IDs, and all old links are now broken. I have a few questions regarding this:

1. When the import was initially done, the log was not exported to a DB table. When I go back to the import screen, it tells me about the unarchived data. Is there a way to run the archiving process now, without doing another import? How? Will this cause forum downtime?

2. There does not appear to exist an SMF redirect script already, but I've downloaded the vB4 version for comparison. Would altering this to work with SMF be a simple matter of changing filenames and regexes, as it appears to be? If not, what else would be required?

Many thanks for the help.


XenForo developer
Staff member
Can you provide some old link format examples? (Forums, threads and members.)

The import data is in xf_import_log since you didn't archive it. You don't have to archive it; it just prevents it from accidentally being overwritten if you do another import. To archive it, you'd have to "start" an import and get to the point where it gives you the option to archive it. From there you don't have to continue.
The format of old links follows:

Thread: http:// <domain> /index.php?topic=<threadid>.0

Post in thread: http:// <domain> /index.php?topic=<threadid>.msg<msgid>#msg<msgid>

Can't find any user or forum links right at the moment. However, these are lower-priority; the site in question is for fiction writing, and so the biggest issue is people's indexes of links, pointing to chapters in separate posts.

Assuming no future imports are planned, is there anything preventing redirects from running successfully off the xf_import_log table?

Jake Bunce

XenForo moderator
Staff member
You didn't provide the new XenForo URL so these instructions assume XenForo is installed at domain.com/xenforo/ . If the directory is different then you need to modify the rewriterules.

Add these rules to the top of the .htaccess file in your web root (where SMF was):

RewriteEngine On

RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+)\.0($|&)
RewriteRule ^index\.php$ /xenforo/showthread.php?t=%2 [R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+).msg([0-9]+)($|&)
RewriteRule ^index\.php$ /xenforo/showpost.php?p=%3 [R=301,L]
Then upload these scripts to the /xenforo directory:


These PHP scripts are needed to do the id mapping because of this:

The import was done without preserving content IDs
Okay, I've successfully gotten the redirection working, via something of a hack involving copying the vB showthread.php to a new index.php and then editing the regexes.

Hello Jake,

My old smf post's link like this;
gezenbilir com/index.php?topic=102261.msg1321440#msg1321440

New xf "same" post's link like this;
gezenbilir com/konu/gezenbilir-amator-denizci-adb-ve-yelken-kursu-1-donem.102261/page-2#post-1321440

When I added this code to .htaccess;
RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+).msg([0-9]+)($|&)
RewriteRule ^index\.php$ /konu/%2/?p=%3 [R=301,L]
Its converting to this link;
gezenbilir com/konu/gezenbilir-amator-denizci-adb-ve-yelken-kursu-1-donem.102261/?p=1321440#msg1321440

And its not working :) Thank you for your helps...


XenForo developer
Staff member
For XF, post links go to:


Which will then redirect to the correct final URL. I don't know if you changed that name with a route filter, but you would need to change/drop the "konu" and the thread ID part of your rewrite.
With this codes;
RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+).msg([0-9]+)($|&)
RewriteRule ^index\.php$ /konu/%2/?post=%3 [R=301,L]
Its failed urls;
How can I convert the links like that (regular XF post url);

Haven't tested but try this
RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+).msg([0-9]+)($|&)
RewriteRule ^index\.php$ /konu/%2/#post=%3 [R=301,L]
Thank you so much but I tried it and result like this;

When I use this; #post=%3 Its converting like that; %23post=

I think this would do it:

RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+).msg([0-9]+)($|&)
RewriteRule ^index\.php$ /konu/%2/#post-%3 [R=301,L]
Thank you so much pal. I think its going to work but there is another issue. Do you have any idea about this?


You don't have permission to access /konu/89007/#post-1399085 on this server.