torontotim
Member
AHHH! Will try. Thanks!
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]
Added .htaccess redirect rules
// *** Variables ***
$redir_url = 'https://www.domain.com'; // URL of your new forum, without trailing slash
$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 = 2; // 0 = testing / 1 = temp redirect / 2 = perm redirect
Does the script have this line at the end?All the redirects work, but not the index.php in forums directory.
// If nothing matches, redirect to the default url
else redirect($redir_url . '/' . $forums . '/');
If I go to index.php, it does redirect to /forums/ instead of the root.Does the script have this line at the end?
Code:// If nothing matches, redirect to the default url else redirect($redir_url . '/' . $forums . '/');
else redirect($redir_url . '/');
- Added XF friendly url's option
- Index.php is now properly redirected to root
# rewrite rules to redirect SMF URLs
# Message redirects
# matching /forum/index.php/topic,101126.msg3826887.html
rewrite ^/forum/index\.php/topic,[0-9]+\.msg([0-9]+)/?(?:wap2|topicseen)?\.html /posts/$1/ permanent;
# matching /forum/index.php?topic=101126.msg3826887
if ($arg_topic ~ [0-9]+\.msg([0-9]+)$) {
set $postid $1;
rewrite ^/forum/index\.php /posts/$postid/? permanent;
}
# matching /forum/index.php?msg=3826887
if ($arg_msg ~ "^([0-9]+)(?:;wap2|$)") {
set $postid $1;
rewrite ^/forum/index\.php /forum/posts/$postid/? permanent;
}
# Thread / Topic redirects
# matching /forum/index.php/topic,101523.25.html
rewrite ^/forum/index\.php/topic,([0-9]+)\.[0-9]+/?(?:wap2|wap|nowap|all|prev|prev_next|prev_next,prev|prev_next,next|topicseen|page2)?\.html /threads/$1/ permanent;
# matching /forum/index.php%3Ftopic%3D96737.0
# http://stackoverflow.com/questions/20470191/external-links-url-encoding-leads-to-3f-and-3d-on-nginx-server
rewrite ^/forum/index\.php\?topic=([0-9]+)\.[0-9]+ /threads/$1/ permanent;
# matching /forum/index.php?topic=65856.0
if ($arg_topic ~ "^([0-9]+)\.[0-9]+(?:;wap2|$)") {
set $threadid $1;
rewrite ^/forum/index\.php /threads/$threadid/? permanent;
}
# Boards redirects
# matching /forum/index.php/board,13.0.html
rewrite ^/forum/index\.php/board,([0-9]+)\.[0-9]+\.html /forums/$1/ permanent;
# matching /forum/index.php%3Fboard%3D3.0
rewrite ^/forum/index\.php\?board=([0-9]+)\.[0-9]+ /forums/$1/ permanent;
# matching /forum/index.php?board=13
if ($arg_board ~ "^([0-9]+)(?:;wap2|$)") {
set $boardid $1;
rewrite ^/forum/index\.php$ /forums/$boardid/? permanent;
}
# matching /memberlist.php?mode=viewprofile&u=2745
rewrite ^/memberlist\.php$ /members/$arg_u/? permanent;
# Redirect old forum homepage
rewrite ^/forum/index.php$ /forums/? permanent;
rewrite ^/forum/ /forums/? permanent;
# Redirect avatar folder (Friendly URLs bug)
rewrite ^/account/avatar /index.php?account/avatar;
# Redirect RSS feed location
rewrite ^/forums/-/index.rss /index.php?forums/-/index.rss;
Added Nginx rewrite rules.
Thanks @Overscan for providing this example.
We use essential cookies to make this site work, and optional cookies to enhance your experience.