Nginx Rewrite and Redirects when removing vbseo URL’s

NOTE these are Nginx rewrites not apache, please see our last blog post for apache/htaccess rewrites here : VBSEO removal Apache/htaccess redirects

UPDATED 2015 So another post of which surrounds forum owners removing vbseo from their forums and opting for vbulletin standard URL’s instead, Most of the rewrites we’ve posted previously have been htaccess rewrites for Apache. Below you will find rewrites for the ever popular Nginx.

vbulletin nginx thread rewrites

Source: 001 – Hierarchic .html type URLs with content relevant forums and threads (Default Settings)

rewrite [^/]+/([\d]+)-.+-([\d]+).html /showthread.php?t=$1&page=$2 break;
rewrite [^/]+/([\d]+)-.+.html /showthread.php?t=$1 break;

Source: 002 – Hierarchic directory type URLs with content relevant threads (used at www.vBSEO.com)

# nginx configuration
location / {
rewrite f[\d]+/.+-([\d]+)/index([\d]+).html /showthread.php?t=$1&page=$2 break;
rewrite f[\d]+/.+-([\d]+)/ /showthread.php?t=$1 break;
rewrite f([\d]+)/index([\d]+).html /forumdisplay.php?f=$1&page=$2 break;
rewrite f([\d]+)/ /forumdisplay.php?f=$1 break; }

Source: 003 – Hierarchic .htm type URLs with content relevant forums (used at www.WebmasterWorld.com)

# nginx configuration
location / {
rewrite [^/]+/([\d]+)-([\d]+).htm /showthread.php?t=$1&page=$2 break;
rewrite [^/]+/([\d]+).htm /showthread.php?t=$1 break; }

Source: 004 – Non-hierarchic .html type URLs using IDs (used at www.DaniWeb.com)

# nginx configuration
location / {
rewrite thread([\d]+)-([\d]+).html /showthread.php?t=$1&page=$2 break;
rewrite thread([\d]+).html /showthread.php?t=$1 break;
rewrite forum([\d]+)-([\d]+).html /forumdisplay.php?f=$1&page=$2 break;
rewrite forum([\d]+).html /forumdisplay.php?f=$1 break; }


Source: 005 – Non-hierarchic directory type URLs using IDs (used at www.MustangEvolution.com)

# nginx configuration
location / {
rewrite t([\d]+)-([\d]+)/ /showthread.php?t=$1&page=$2 break;
rewrite t([\d]+)/ /showthread.php?t=$1 break;
rewrite f([\d]+)-([\d]+)/ /forumdisplay.php?f=$1&page=$2 break;
rewrite f([\d]+)/ /forumdisplay.php?f=$1 break; }

Source: 006 – Hierarchic .html type URLs with content relevant threads (used at www.vBulletinSetup.com)

# nginx configuration
location / {
rewrite f[\d]+/.+-([\d]+)-([\d]+).html /showthread.php?t=$1&page=$2 break;
rewrite f[\d]+/.+-([\d]+).html /showthread.php?t=$1 break;
rewrite f([\d]+)/i([\d]+).html /forumdisplay.php?f=$1&page=$2 break;
rewrite f([\d]+)/ /forumdisplay.php?f=$1 break; }

To redirect your category URL’s as well you will need to create a permanent redirect for EACH category. You can do this by using something like below :

Nginx 301 Redirect – Single page

if ( $request_filename ~ OLD-URL/ ) {
rewrite ^ http://yourforum.com/new-url/? permanent;
}

Standard vbulletin URL’s to Mod Rewrite friendly URL’s Nginx rewrites

rewrite /threads/.*$ /showthread.php?$args last;
rewrite /forums/.*$ /forumdisplay.php?$args last;
rewrite /members/.*$ /member.php?$args last;
rewrite /blogs/.*$ /blog.php?$args last;
rewrite /entries/.*$ /entry.php?$args last;

Hopefully this will speed up someones day as these rewrites slowed us down considerably on a particular job recently.