motorscript.com

Vbulletin to SMF 301 Permanent URL Redirects

Published:
Note: This is an archived post. Information may not be relevant now.

Switching to SMF from vbulletin is easy. The database converters are easily available. The only tricky part is to keep the old links alive, which isn’t difficult either with a little regex knowledge and Apache mod_rewrite power.

Since this is a permanent switch, 301 redirects are used to send acknowldgements to web spiders. The old vbulletin installation used SEO friendly URLs and the new SMF has PrettyURLs Mod, which i think despite of no SMF experience at all is a must.

The following is the content from .htaccess file which should reside at the root directory of your forum.

.htacess

RewriteEngine on
RewriteBase /

#Redirect www.mysite.com to mysite.com
RewriteCond %{HTTP_HOST} ^www.mysite.com$ [NC]
RewriteRule ^(.*)$ http://mysite.com/$1 [R=301]

# VB to SMF Redirects

RewriteRule ^forum.php index.php [R=301]
#Rewrite threads, thread id is captured
RewriteRule ^threads/([0-9]+)-.* index.php?topic=$1 [R=301]
#Rewriting archive to wap2 version of pages
RewriteRule ^archive/index.php/t-([0-9]+).* /forums/index.php?topic=$1&wap2 [R=301]

#Rule for direct post permalink, thread id and post id are captured, doesn't seem to work with me
#RewriteRule ^threads/([0-9]+)-.*?p=([0-9]+) index.php?topic=$1.msg$2[R=301,L]

#The following rewrites work only with PrettyURL mod

#Rewriting member profile links
RewriteRule ^members/([0-9]+)-(.*) profile/$2 [R=301]
RewriteRule ^members mlist/ [R=301]
RewriteRule ^members/ mlist/ [R=301]
RewriteRule ^search.php search/ [R=301,QSA]

RewriteRule ^faq.php /forums/help/ [R=301]
RewriteRule ^tags.php /forums/index.php [R=301]

RewriteRule ^sendmessage.php /contact-us [R=301]

#The following requires the activation of RewriteMap http://stackoverflow.com/questions/703709/rewritemap-activation
RewriteMap tolower int:tolower
#Rewrite http://mysite.com/99-Forumname to http://mysite.com/forumname
RewriteRule ^([0-9]+)-(.+) /${tolower:$2} [R=301,L]
#RewriteRule ^forums/([0-9]+)-.* index.php?board=$1 [R=301]