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

XF 1.5 SMF Link Convertion?

#1
Hello,

How can I convert SMF links;
domain.com/index.php?topic=94212

to XF links;
domain.com/topic/example-topic.94212


Thank you so much for your help...
 

Jake Bunce

XenForo moderator
Staff member
#2
Add these rules to the top of the .htaccess file in your web root:

Code:
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+)($|&)
RewriteRule ^index\.php$ /topic/%2/? [R=301,L]
 
#3
Hi Jake!

Old smf links;
gezenbilir.com/index.php?topic=97905

New xf links;
gezenbilir.com/konu/dag-kazalari.97905

And after your codes;
gezenbilir.com/topic/97905

Do you have any recommendation?

Regards
 
#4
Hi again,

I found the problem.

Regular smf links are like this;
gezenbilir.com/index.php?topic=97905.0

And second pages;
gezenbilir.com/index.php?topic=97905.10

Third pages;
gezenbilir.com/index.php?topic=97905.20

If I write the old smf links without .0 all they are working fine and opening the new xf links. But if I click an old smf link with .0 or .10 its opening to gezenbilir.com/topic/97905 wrong link.

Any idea? :)
 

Jake Bunce

XenForo moderator
Staff member
#5
Add these rules to the top of the .htaccess file in your web root:

Code:
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|\?)topic=([0-9]+)(\.[0-9]+)?($|&)
RewriteRule ^index\.php$ /konu/%2/? [R=301,L]
That should allow both types of links to work. And the above rules have been updated to redirect to the /konu route instead of /topic like you originally stated.