Ask question

Ask Questions and Get Answers from Our Community

Answer

Answer Questions and Become an Expert on Your Topic

Contact Staff

Our Experts are Ready to Answer your Questions

ตอนนี้เราจะมีแต่เรื่องเกี่ยวกับ xenForo & vBulletin เป็นหลักนะครับ จะมีโพสต์ข่าวสารที่เกี่ยวข้องกับ xenForo & vBulletin และเกี่ยวข้องกันเช่น โฮส เวบไซต์ แอดมิน ...

วิธีทำ 2.x Redirection script for SMF 2.0 2.2

admin

Staff Member
Administrator
สมัครเมื่อ
21 พฤษภาคม 2009
ข้อความโพสต์
1,272
คะแนนการตอบรับ
118
แต้มสะสม
63
Redirect rules for SMF 2.0.

Option 1 - .htaccess

There are a few things for .htaccess to work correctly:
Open your .htaccess file.
After RewriteEngine On add:
Code:
RewriteCond %{QUERY_STRING} (^|\?|&)board=([0-9]+)\.[0-9]+($|&)
RewriteRule ^index\.php$ /forum/forums/%2/? [R=301,L]

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

RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+).msg([0-9]+)($|&)
RewriteRule ^index\.php$ /forum/threads/%2/#post-%3? [NE,R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)PHPSESSID=(.*);topic=([0-9]+)\.[0-9]+($|&)
RewriteRule ^index\.php$ /forum/threads/%3/? [NE,R=301,L]
Option 2 - script

You can also use a script to redirect SMF to XF.
This script also handles thread page redirects, which the .htaccess option does not have! This is because it needs a bit of calculation.

There are a few things for the script to work correctly:
Configuration:

Download the script and modify to your needs.
Put it in the original location of your old SMF forum, overwriting the original index.php file.

You will need to change these variables in the script:

Code:
// *** Variables ***

$redir_url = 'https://www.yourdomain.com'; // URL of your new forum, without trailing slash
$friendly_url = '1'; // 0 = Don't use XF friendly URL's / 1 = use XF friendly URL's
$forums = 'forums'; // Default path to index (only change this if you are using route filters)
$threads = 'threads'; // Default path to topic (only change this if you are using route filters)
$posts = 'posts'; // Default path to posts (only change this if you are using route filters)
$members = 'members'; // Default path to members (only change this if you are using route filters)
$threads_count = 20; // Make sure the number of messages per page is the same for SMF and XenForo.
$mode = 0; // 0 = testing / 1 = temp redirect / 2 = perm redirect
Note 1: If you installed Xenforo in a subdirectory, you can use something like $redir_url = 'https://www.yourdomain.com/subdir';

Note 2: Make sure you use the same value for the number of messages per page for both forums.
So, if SMF was setup for 10 messages per page, you should do the same for Xenforo (Setup > Options > Threads > Discussions per page) and modify $threads_count to 10. This way you can also redirect thread pages correctly!

Examples of the redirections this script handles:
ที่มา
 

ไฟล์แนบ



Top