1

I would like to know how to rewrite the nginx this url:

Old URL: http://www.webcheats.com.br/vbulletin/showthread.php?t=2175433

New URL: http://www.webcheats.com.br/threads/2175433/

thanks

cnst
  • 25,870
  • 6
  • 90
  • 122

2 Answers2

1
location = /vbulletin/showthread.php {
    return 301 /threads/$arg_t/;
}
cnst
  • 25,870
  • 6
  • 90
  • 122
0

If you're using Xenforo 2 on nginx and you had previously migrated from vBulletin there is an addon for Xenforo 2 that handles the redirects: Xenforo Redirects for vBulletin

But this addon was made for Apache, and out of the box it won't work correctly with the SEO friendly URL feature of Xenforo 2 & nginx. To resolve that issue you need to setup your nginx config to work with SEO friendly URLS using the XF2 Documentation.

Last thing you need to do is read this post which outlines the cause of the issue and the fix. The cause of the problem is this line:

  try_files $uri =404;

It stops the redirect from occuring because the old vbulletin php files don't exist. The final fix is to set the block to look like this:

location ~ \.php$ {
  try_files $uri /index.php?$uri&$args;
  #try_files $uri =404;
  fastcgi_pass    127.0.0.1:9000;
  fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include         fastcgi_params;
}
GuidedHacking
  • 3,628
  • 1
  • 9
  • 59