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

jeffwidman

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:
      /forum/index.php/board,13.0.html
      /forum/index.php?board=13
    • Xenforo URL structure:
      /community/index.php?forums/13/
  2. Threads/topics:
    • SMF URL structure:
      /forum/index.php/topic,101.0.html
      /forum/index.php?topic=101.0
    • Xenforo URL structure:
      /community/index.php?threads/101/
  3. Messages/Posts:
    • SMF URL structure:
      Note: sometimes these include extra stuff after the message ID, sometimes not
      /forum/index.php/topic,101.msg38.html#msg38
      /forum/index.php?topic=101.msg38/boardseen.html#new
    • Xenforo URL structure:
      /community/index.php?posts/38/
  4. Users:
    • SMF URL structure--never written out, always passed as a query parameter:
      /forum/index.php?action=profile;u=110
    • Xenforo URL structure:
      /community/index.php?members/110
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.
 
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.
 
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.
 
Back
Top Bottom