1

Nginx redirect/rewrite Rule

How to make the configuration of nginx for redirection:

Old Url

http://www.webcheats.com.br/forum/elsword-downloads-de-cheats-utilitarios/2369461-26-04-revolution-trainer-elsword.html

  1. /forum/ - It is the folder that installed vbulletin
  2. /elsword-downloads-de-cheats-utilitarios/ - is the forum name that the topic / in xenforo will not appear
  3. 2369461 - is the ID that will have to appear in the url xenforo
  4. -26-04-revolution-trainer-elsword.html - is the topic name that accessing, no matter what the xenforo because with the right ID it corrects the topic name in the URL.

New Url

http://www.webcheats.com.br/threads/26-04-revolution-trainer-elsword.2369461/

  1. /threads/ - the xenforo automatically add the address when accessing this one topic.
  2. 26-04-revolution-trainer-elsword - Topic name, even if the xenforo system corrects'm wrong
  3. 2369461 - Most importantly, the topic ID

Another examples

Old Url www.webcheats.com.br/forum/resolvidos/2343690-reposicao-dos-meus-posts.html

New Url www.webcheats.com.br/threads/reposição-dos-meus-posts.2343690/

Old Url www.webcheats.com.br/forum/league-of-legends-downloads-de-cheats-utilitarios/2516190-drophack-1-3-funcional-apenas-por-30-dias-aproveite-o-mais-rapido-possivel-veja-ma.html

New Url www.webcheats.com.br/threads/drophack-1-3-funcional-apenas-por-30-dias-aproveite-o-mais-rapido-possivel-veja-ma.2516190/

cnst
  • 25,870
  • 6
  • 90
  • 122

2 Answers2

0

Add this to you server www.webcheats.com.br config

location ^~ /forum/ {
    rewrite ^/forum/(.+)/([0-9]+)-(.+)\.html$ /threads/$3.$2/ redirect;
}
Max P.
  • 5,579
  • 2
  • 13
  • 32
0

Another option would be to not carry over the slug, as it may or may not be the same, so, might as well discard it right away, and make XenForo makes its own one.

location ^~ /forum/ {
    rewrite ^/forum/[^/]+/([0-9]+)- /threads/$1 redirect;
}
cnst
  • 25,870
  • 6
  • 90
  • 122