- Compatible XF Versions
- 1.5
- Additional Requirements
- XenForo:
"Retain imported content IDs" during SMF import.
"Use Full Friendly URLs" should be enabled in XenForo.
"Include Content Title in URLs" might be enabled but It will give you an extra redirect. (personally I don't like Titles in URLs)
SMF:
This script is designed for default SMF URLs. If you enabled "Search engine friendly URLs" in SMF, the redirection will not work with this script.
This script will redirect your SMF forum URL's to XenForo.
The reason I didn't use .htaccess or Nginx rewrites is because the redirects needed some simple math. This was not easily possible with .htaccess / nginx.
Usage
Replace your SMF index.php with this redirect script and edit the configuration part.
I'll assume you installed XenForo in a new directory. This will make things much easier!
If you are going to install SMF and XenForo in the same directory, you will need to do some extra redirects in .htaccess/nginx which filters the SMF requests and directs them to this script.
You should test this script before the real migration. Make sure everything works.
Configuration
Just edit the first part of the script to suite your needs:
PHP:
$redir_url = 'https://www.domain.com/smf'; // URL of your new forum, without trailing slash
$forums = 'forums'; // URL name of forums (only change this if you are using route filters)
$threads = 'threads'; // URL name of threads (only change this if you are using route filters)
$posts = 'posts'; // URL name of posts (only change this if you are using route filters)
$members = 'members'; // URL name members (only change this if you are using route filters)
$threads_count = 10; // Make sure the number of threads is the same for SMF and XenForo.
$mode = 0; // 0 = testing / 1 = temp redirect / 2 = perm redirect
First you should use mode = 0 to see what the redirect is doing, after that you can use mode = 1 to test the real thing. After that, if everything is fine, use mode = 2.
Example Redirections
Boards
http://www.domain.com/smf/index.php?board=5.20
to
http://www.domain.com/xenforo/forums/5/
Messages
https://www.domain.com/smf/index.php?msg=123
to
https://www.domain.com/xenforo/posts/123/
https://www.domain.com/smf/index.php?topic=10.msg123
to
https://www.domain.com/xenforo/posts/123/
Topics
https://www.domain.com/smf/index.php?topic=10.110
to
https://www.domain.com//xenforo/threads/10/page-12
Profiles
https://www.domain.com/smf/index.php?action=profile;u=123
to
https://www.domain.com/xenforo/members/123/
The reason I didn't use .htaccess or Nginx rewrites is because the redirects needed some simple math. This was not easily possible with .htaccess / nginx.
Usage
Replace your SMF index.php with this redirect script and edit the configuration part.
I'll assume you installed XenForo in a new directory. This will make things much easier!
If you are going to install SMF and XenForo in the same directory, you will need to do some extra redirects in .htaccess/nginx which filters the SMF requests and directs them to this script.
You should test this script before the real migration. Make sure everything works.
Configuration
Just edit the first part of the script to suite your needs:
PHP:
$redir_url = 'https://www.domain.com/smf'; // URL of your new forum, without trailing slash
$forums = 'forums'; // URL name of forums (only change this if you are using route filters)
$threads = 'threads'; // URL name of threads (only change this if you are using route filters)
$posts = 'posts'; // URL name of posts (only change this if you are using route filters)
$members = 'members'; // URL name members (only change this if you are using route filters)
$threads_count = 10; // Make sure the number of threads is the same for SMF and XenForo.
$mode = 0; // 0 = testing / 1 = temp redirect / 2 = perm redirect
First you should use mode = 0 to see what the redirect is doing, after that you can use mode = 1 to test the real thing. After that, if everything is fine, use mode = 2.
Example Redirections
Boards
http://www.domain.com/smf/index.php?board=5.20
to
http://www.domain.com/xenforo/forums/5/
Messages
https://www.domain.com/smf/index.php?msg=123
to
https://www.domain.com/xenforo/posts/123/
https://www.domain.com/smf/index.php?topic=10.msg123
to
https://www.domain.com/xenforo/posts/123/
Topics
https://www.domain.com/smf/index.php?topic=10.110
to
https://www.domain.com//xenforo/threads/10/page-12
Profiles
https://www.domain.com/smf/index.php?action=profile;u=123
to
https://www.domain.com/xenforo/members/123/