To redirect your old MyBB forum URLs to the new Discourse URLs in bulk, you can set up a series of redirects in your web server configuration or using a .htaccess file (if you’re using Apache), or equivalent for other servers. Here’s how you can do it:
Using Apache (.htaccess)
Open your .htaccess file (usually located in the root directory of your site).
Add the following redirect rules:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/thread-(.*)\.html$ [NC]
RewriteRule ^thread-(.*)\.html$ /$1/ [R=301,L]
Explanation:
RewriteEngine On enables the mod_rewrite module.
RewriteCond checks if the requested URL matches the pattern thread-the-title-of-the-post.html (with .* capturing the post title).
RewriteRule redirects any old URL of the form /thread-title-of-the-post.html to /title-of-the-post/ (i.e., removing the thread- and .html suffix).
R=301 indicates it’s a permanent redirect, which is ideal for SEO purposes.
L means it’s the last rule to be processed if the condition matches.
Using Nginx (for Nginx servers)
If you’re using Nginx, you can add the following rules to your server block:
Test the redirects first to ensure that they work as expected, especially for posts with special characters or different formats in the titles.
A 301 Redirect is permanent, which is ideal for SEO. However, if you’re unsure and want to test it first, you can use 302 Redirect (temporary) instead.
If there are a lot of posts, you might need to adjust the pattern in the RewriteRule or location block to accommodate variations in the URLs.
This should ensure that users and search engines are properly redirected from the old MyBB URLs to the new Discourse URLs.