XF 1.4 Nginx rewrite rules to redirect SMF urls to Xenforo urls?


Active member
I am migrating a forum from Simple Machines to Xenforo, and struggling to craft the Nginx rewrite rules.

Essentially, I need to write a regex to parse the SMF urls and extract the ID of the board/forum, topic/thread, message/post, or user, then insert it into Xenforo urls.

It's slightly more complex though because sometimes the IDs are passed as a parameter, and sometimes written out in the URL. SMF supports both, and I've got inbound links with both forms, so need to rewrite both.

Here are the incoming URLs that I am trying to redirect:
  1. Board/forum index
    • SMF URL structure:
    • Xenforo URL structure:
  2. Threads/topics:
    • SMF URL structure:
    • Xenforo URL structure:
  3. Messages/Posts:
    • SMF URL structure:
      Note: sometimes these include extra stuff after the message ID, sometimes not
    • Xenforo URL structure:
  4. Users:
    • SMF URL structure--never written out, always passed as a query parameter:
    • Xenforo URL structure:
The rewrite rules should only match when the url includes `/forum/index.php` so it doesn't catch other random urls.

I am pretty green with regex, any help is appreciated.


Active member
Actually I think I've got this--figured out the regex, just need to doublecheck it in Nginx, will update this post with the answer once I do for future reference...
Hi Jeff,

If you have some time, I would be interested by knowing how you did the rewriting. I've migrated my forum from SMF 2.0.7 and I need to do also some rewriting.


Active member
I was able to rewrite the static html versions, but rewriting the ?args part hasn't been working. My regex is correct, it's just that I'm using Centminmod and something about the way the includes are written in the Nginx conf file are causing Nginx to pick a different regex before it ever gets to evaluating my regex.

I'm paying a friend who's an excellent sys admin to fix it, once he does I'll try to remember to post here.