1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Installation, Upgrade, and Import Support' started by jeffwidman, Dec 12, 2014.

  1. jeffwidman

    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:
      • 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.
  2. jeffwidman

    jeffwidman 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...
  3. Cmely

    Cmely Member

    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.
  4. jeffwidman

    jeffwidman 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.
  5. Cmely

    Cmely Member

    Ok. That would be great if you can. Thanks.
  6. jeffwidman

    jeffwidman Active Member

  7. Cmely

    Cmely Member

    Thank you very much @jeffwidman for the link. I'm going to look at that closely...even if I'm afraid this is a little bit out of my scope of knowledge :eek:;)

Share This Page