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

Customizing URLs

Umit

Active member
#1
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.html
/thread234-2.html (second page)
/forum25.html

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 ?
 

Mike

XenForo developer
Staff member
#2
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.
 

Umit

Active member
#3
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
 

Shadab

Well-known member
#4
Mike, would these work?

Code:
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

Active member
#5
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...
 

Umit

Active member
#6
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.
 

James

Well-known member
#7
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...
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.
Because your first rewrite rule used the same variable ($1) for the thread ID and the page number ;) Naughty Shadab!