Redirecting MyBB URL's

m1ne

Well-known member
Hello.

I've not converted my MyBB forum yet, but I know this will be a problem, so I am posting now.
Is there any way to redirect old MyBB url's to XF links? Using htaccess perhaps?
MyBB URL's look like this,

/thread-30028.html
/forum-121.html
/user-2.html

I've got a lot of indexed url's so I hope there's a way to do this.

Thank you.
 
Thank you!

Here's some Old URLs:
http://pokebeach.com/forums/thread-shiny-charizard-codes-at-german-gamestops-3-20
http://pokebeach.com/forums/thread-have-a-simple-forum-question-ask-here
http://pokebeach.com/forums/thread-pokemon-dreams

The new XF forum has not been setup yet, but it would be using friendly URLs and be at the exact same location as the current forums. So basically those links above would go to the new threads and I guess new XF threads would either follow the same format or, I think more likely, be using whatever XF's default friendly URL setup is.
 
As those URLs have no IDs in them, they can't really be redirected automatically. Individual redirect rules would need to be made for each thread.
 
I just found this in my Nginx config file. Would it be of any help?

Code:
    location /forums {
    error_log /var/log/nginx/error.forums.log;
        rewrite ^/forums/([^&]*)&(.*)$ http://pokebeach.com/forums/$1?$2 last;
        rewrite ^/forums/sitemap-([^./]+)\.xml$ /forums/misc.php?google_seo_sitemap=$1 last;
        rewrite ^/forums/forum-([^./]+)$ /forums/forumdisplay.php?google_seo_forum=$1 last;
        rewrite ^/forums/thread-([^./]+)$ /forums/showthread.php?google_seo_thread=$1 last;
        rewrite ^/forums/announcement-([^./]+)$ /forums/announcements.php?google_seo_announcement=$1 last;
        rewrite ^/forums/user-([^./]+)$ /forums/member.php?action=profile&google_seo_user=$1 last;
        rewrite ^/forums/calendar-([^./]+)$ /forums/calendar.php?google_seo_calendar=$1 last;
        rewrite ^/forums/event-([^./]+)$ /forums/calendar.php?action=event&google_seo_event=$1 last;

        #error_page   404    misc.php?google_seo_error=404 last;

        rewrite ^/forums/forum-([0-9]+)\.html$ /forums/forumdisplay.php?fid=$1 last;
        rewrite ^/forums/forum-([0-9]+)-page-([0-9]+)\.html$ /forums/forumdisplay.php?fid=$1&page=$2 last;

        rewrite ^/forums/thread-([0-9]+)\.html$ /forums/showthread.php?tid=$1 last;
        rewrite ^/forums/thread-([0-9]+)-page-([0-9]+)\.html$ /forums/showthread.php?tid=$1&page=$2 last;
        rewrite ^/forums/thread-([0-9]+)-lastpost\.html$ /forums/showthread.php?tid=$1&action=lastpost last;
        rewrite ^/forums/thread-([0-9]+)-nextnewest\.html$ /forums/showthread.php?tid=$1&action=nextnewest last;
        rewrite ^/forums/thread-([0-9]+)-nextoldest\.html$ /forums/showthread.php?tid=$1&action=nextoldest last;
        rewrite ^/forums/thread-([0-9]+)-newpost\.html$ /forums/showthread.php?tid=$1&action=newpost last;
        rewrite ^/forums/thread-([0-9]+)-post-([0-9]+)\.html$ /forums/showthread.php?tid=$1&pid=$2 last;

        rewrite ^/forums/post-([0-9]+)\.html$ /forums/showthread.php?pid=$1 last;

        rewrite ^/forums/announcement-([0-9]+)\.html$ /forums/announcements.php?aid=$1 last;

        rewrite ^/forums/user-([0-9]+)\.html$ /forums/member.php?action=profile&uid=$1 last;

        rewrite ^/forums/calendar-([0-9]+)\.html$ /forums/calendar.php?calendar=$1 last;
        rewrite ^/forums/calendar-([0-9]+)-year-([0-9]+)\.html$ /forums/calendar.php?action=yearview&calendar=$1&year=$2 last;
        rewrite ^/forums/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ /forums/calendar.php?calendar=$1&year=$2&month=$3 last;
        rewrite ^/forums/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ /forums/calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4 last;
        rewrite ^/forums/calendar-([0-9]+)-week-(n?[0-9]+)\.html$ /forums/calendar.php?action=weekview&calendar=$1&week=$2 last;

        rewrite ^/forums/event-([0-9]+)\.html$ /forums/calendar.php?action=event&eid=$1 last;
 
Thank you!

Here's some Old URLs:
http://pokebeach.com/forums/thread-shiny-charizard-codes-at-german-gamestops-3-20
http://pokebeach.com/forums/thread-have-a-simple-forum-question-ask-here
http://pokebeach.com/forums/thread-pokemon-dreams

The new XF forum has not been setup yet, but it would be using friendly URLs and be at the exact same location as the current forums. So basically those links above would go to the new threads and I guess new XF threads would either follow the same format or, I think more likely, be using whatever XF's default friendly URL setup is.

Assuming XF is installed at /xf

Upload this file to the /xf directory:

https://xenforo.com/community/threads/redirecting-mybb-urls.28809/page-2#post-692873

Copy the mybb_google_seo table per that post.

Then add these rules to your nginx config:

Code:
        location ~* ^/forums/thread-[^/]+$ {
                rewrite thread-([^/]+)$
/xf/mybbthreadredir.php?slug=$1 last;
        }

That should do it.
 
Thank you, but I am thinking of using /community as my XF directory, and I use forums for my MyBB installation. Is it possible to redirect from a different directory?
 
Here are some examples of MyBB URL's

http://www.sandiegohdtv.org/forums/forum-Test-Forum
http://www.sandiegohdtv.org/forums/forum-General-OTA
http://www.sandiegohdtv.org/forums/thread-Maybe-TW-cable-will-start-to-figure-us-out
http://www.sandiegohdtv.org/forums/thread-test--4837

Sometimes when multiple posts have the same name, then it shows a different ID. I will use the standard XenForo URL's, and I want to use www.sandiegohdtv.org/community/ for my forum and not www.sandiegohdtv.org/forums/. Can I also redirect it, so that it will go to Community. I can install another test install board, since I accidentally deleted it again. I am almost ready to migrate. Just need this all sorted out.
 
As your URLs don't generally have IDs, automatic redirection is very difficult -- the normal approach in this case is to, unfortunately, write a redirection for every URL. A programmatic approach may be possible based on manipulating the title, but it will be pretty horrible for performance (and would likely need to be custom developed).
 
Here are some examples of MyBB URL's

http://www.sandiegohdtv.org/forums/forum-Test-Forum
http://www.sandiegohdtv.org/forums/forum-General-OTA
http://www.sandiegohdtv.org/forums/thread-Maybe-TW-cable-will-start-to-figure-us-out
http://www.sandiegohdtv.org/forums/thread-test--4837

Sometimes when multiple posts have the same name, then it shows a different ID. I will use the standard XenForo URL's, and I want to use www.sandiegohdtv.org/community/ for my forum and not www.sandiegohdtv.org/forums/. Can I also redirect it, so that it will go to Community. I can install another test install board, since I accidentally deleted it again. I am almost ready to migrate. Just need this all sorted out.

Add these rules to the top of the .htaccess file in /forums (where MyBB is installed):

Code:
RewriteEngine On

RewriteRule ^thread-([^/]+)$ /community/mybbthreadredir.php?slug=$1 [R=301,L]
RewriteRule ^forum-([^/]+)$ /community/mybbforumredir.php?slug=$1 [R=301,L]

Copy the mybb_google_seo table from MyBB's database to XF's database.

Then upload these two attached files to your /community directory (where XF is installed):

https://xenforo.com/community/threads/redirecting-mybb-urls.28809/page-2#post-692873
https://xenforo.com/community/threads/redirecting-mybb-urls.28809/page-2#post-708975

Be sure to edit both files to specify your forum URL.

That should do it.
 
@Kyros

Add these rules to the top of the .htaccess file in your web root:

Code:
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|\?)tid=([0-9]+)&pid=([0-9]+)($|&)
RewriteRule ^showthread\.php$ /index.php?posts/%3/ [R=301,L]

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

RewriteCond %{QUERY_STRING} (^|\?)action=profile&uid=([0-9]+)($|&)
RewriteRule ^member\.php$ /index.php?members/%2/ [R=301,L]

RewriteCond %{QUERY_STRING} (^|\?)fid=([0-9]+)($|&)
RewriteRule ^forumdisplay\.php$ /index.php?forums/%2/ [R=301,L]
 
@Kyros

Add these rules to the top of the .htaccess file in your web root:

Code:
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|\?)tid=([0-9]+)&pid=([0-9]+)($|&)
RewriteRule ^showthread\.php$ /index.php?posts/%3/ [R=301,L]

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

RewriteCond %{QUERY_STRING} (^|\?)action=profile&uid=([0-9]+)($|&)
RewriteRule ^member\.php$ /index.php?members/%2/ [R=301,L]

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

Thank you for the hasty response.

I have tried both adding this code directly at the top and after the <IfModule mod_rewrite.c> line, but there hasn't been any changes. Is there any steps prior to this that I may be missing?
 
Thank you for the hasty response.

I have tried both adding this code directly at the top and after the <IfModule mod_rewrite.c> line, but there hasn't been any changes. Is there any steps prior to this that I may be missing?

If it's not working then send me a PM with FTP access and I will take a look.
 
Top Bottom