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

Customizing URLs

Discussion in 'XenForo Pre-Sales Questions' started by Umit, Sep 20, 2010.

  1. Umit

    Umit Active Member

    Hi, i have a forum (vb3.7) and i'd like to switch to XF when the first beta released.

    My forums URLs are like this:
    /thread234-2.html (second page)

    Can I customize the URLs in XF and hold my URLs same? (include thread and forum IDs after convert)

    If i cant what i asked above, how can i redirect thread234.html to showthread.php?t=234 ?
  2. Mike

    Mike XenForo Developer Staff Member

    The URLs are not customizable to that degree. You would need to use 301 redirects using mod_rewrite to redirect to our thread structure (or vB's showthread.php structure). The IDs won't be the same across imports anyway.
  3. Umit

    Umit Active Member

    Thank you Mike, so it is possible with htaccess.
    Can anyone help me to create the htaccess file?

    forum23.html should redirect to showforum.php?t=23
    thread234.html should redirect to showthread.php?t=234
    thread234-2.html should redirect to showtread.php?t=234&page=2
  4. Shadab

    Shadab Well-Known Member

    Mike, would these work?

    RewriteRule ^forum([0-9]+)\.html$           forumdisplay.php?f=$1       [R=301,L]
    RewriteRule ^thread([0-9]+)\.html$          showthread.php?t=$1         [R=301,L]
    RewriteRule ^thread([0-9]+)-([0-9]+)\.html$ showthread.php?t=$1&page=$2 [R=301,L]
    Umit likes this.
  5. Umit

    Umit Active Member

    RewriteRule ^thread([0-9]+)-([0-9]+)\.html$ showthread.php?t=$1&page=$1 [R=301,L]

    is not working properly, and redirecting to showthread.php?t=234&page=234 (thread234-2.html)

    anyhelp? i need to complete this job before switch to xenforo...
  6. Umit

    Umit Active Member

    RewriteRule ^thread([0-9]+)-([0-9]+)\.html$ showthread.php?t=$1&page=$2 [R=301,L]
    is working now, dont know why it didnt work in my local wamp.
  7. James

    James Well-Known Member

    Because your first rewrite rule used the same variable ($1) for the thread ID and the page number ;) Naughty Shadab!
    Umit likes this.
  8. Shadab

    Shadab Well-Known Member

    Just an oversight on my part! Sorry. :)

    Corrected in my previous post now.
    Umit likes this.

Share This Page