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

XF 1.2 SMF redirect to xF

Skylined

Active member
#1
Could somebody please help me to redirect from SMF to xF?

Sample

Code:
SMF - http://www.mtb.com.uy/foro/index.php?topic=5234.0
xF - http://www.mtb.com.uy/foro/temas/asiento-antiprostatico-%C2%BFes-necesario.5234/
Temas is spanish for threads. :)
 

Jake Bunce

XenForo moderator
Staff member
#3
Add to the top of the .htaccess file in the /foro directory:

Code:
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+)\.
RewriteRule ^index\.php$ /foro/temas/%2/? [R=301,L]
 

Skylined

Active member
#4
Thank you @Jake Bunce, it worked! :)

There's one more that needs to be converted.
It's the same as above but with .html at the end.

Code:
http://www.mtb.com.uy/foro/index.php/topic,1014.0.html
 

Jake Bunce

XenForo moderator
Staff member
#5
Thank you @Jake Bunce, it worked! :)

There's one more that needs to be converted.
It's the same as above but with .html at the end.

Code:
http://www.mtb.com.uy/foro/index.php/topic,1014.0.html
Amendment to previous rules to include the new URL:

Code:
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+)\.
RewriteRule ^index\.php$ /foro/temas/%2/? [R=301,L]

RewriteRule ^index\.php/topic,([0-9]+)\. /foro/temas/$1/ [R=301,L]
 

Skylined

Active member
#7
Found some more, this ones are linked to a specific post in a thread.

From
Code:
http://www.mtb.com.uy/foro/index.php/topic,2354.msg29258.html

To
Code:
http://www.mtb.com.uy/foro/temas/resultados-de-%E2%80%9Cgran-premio-orestes-carballo%E2%80%9D.2354/#post-29258
 

Jeremy

Well-known member
#8
Code:
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+)\.
RewriteRule ^index\.php$ /foro/temas/%2/? [R=301,L]

RewriteRule ^index\.php/topic,([0-9]+)\. /foro/temas/$1/ [R=301,L]
RewriteRule ^index\.php/topic,([0-9]+)\.msg([0-9]+)\. /foro/posts/$2/ [R=301,L]
Amend with that and it should work.
 

Mike

XenForo developer
Staff member
#12
Code:
RewriteRule ^index\.php/topic,([0-9]+)\. /foro/temas/$1/ [R=301,L]
RewriteRule ^index\.php/topic,([0-9]+)\.msg([0-9]+)\. /foro/posts/$2/ [R=301,L]
Flip the order around -- the "msg" one needs to go first as the general thread one matches both.
 

Skylined

Active member
#14
Found more.

Before
Code:
http://www.mtb.com.uy/foro/index.php/board,5.0.html
After
Code:
http://www.mtb.com.uy/foro/foro/carreras.5/
 

Jake Bunce

XenForo moderator
Staff member
#15
Found more.

Before
Code:
http://www.mtb.com.uy/foro/index.php/board,5.0.html
After
Code:
http://www.mtb.com.uy/foro/foro/carreras.5/
Add to top of .htaccess file in /foro directory:

Code:
RewriteEngine On

RewriteRule ^index\.php/board,([0-9]+)\. /foro/foro/$1/ [R=301,L]
 

Skylined

Active member
#17
Uruguay is moving from second level domains to first level domains (.com.uy to just .uy).


I would like to change two things:
  1. Move from mtb.com.uy to just mtb.uy
  2. Move my forum from mtb.uy/foro to the root of mtb.uy

Could you guys please help me with this redirection?
 

Jake Bunce

XenForo moderator
Staff member
#18
@Skylined

That is all doable with one exception. When you move from /foro to / that will cause your current "foro" route to interfere with any redirects that we setup for the old /foro directory. Ideally you will need to change the name of your "foro" route to something else after the move, otherwise you won't be able to redirect traffic from /foro to /.
 

Jake Bunce

XenForo moderator
Staff member
#20
Uruguay is moving from second level domains to first level domains (.com.uy to just .uy).


I would like to change two things:
  1. Move from mtb.com.uy to just mtb.uy
  2. Move my forum from mtb.uy/foro to the root of mtb.uy

Could you guys please help me with this redirection?
Thanks @Jake Bunce. :)

So what would I have to do if I name the route as "foros"?
Move the XF files to your web root and update this setting:

Admin CP -> Home -> Options -> Basic Board Information -> Board URL

Delete the old /foro directory.

Add these rules to the top of the .htaccess file in your web root:

Code:
RewriteEngine On

# enforce new domain, mtb.uy
RewriteCond %{HTTP_HOST} !^mtb\.uy$
RewriteRule ^(.*)$ http://mtb.uy/$1 [R=301,L]

# redirect old /foro directory to web root
RewriteRule ^foro/(.*)$ /$1 [R=301,L]