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

XF 1.2 SMF internal links after migration

shorepower

Active member
#1
After migration there are some small errors we are trying to correct one by one. One of the errors is that several posts contains links to other posts and as a migration tool will not convert these links we planned to do it via an update in the database.

To make it simple. Attached is two examples.

From:
Code:
[url=http://www.mydomain.com/vin/champagne-bourgogne-priser/msg40201/#msg40201]traden[/url]
To:
Code:
[url=http://www.mydomain.com/goto/post?id=40201#post-40201]traden[/url]
and from
Code:
[url=http://www.mydomain.com/forum/index.php?topic=189.msg2564#msg2564]http://www.mydomain.com/forum/index.php?topic=189.msg2564#msg2564[/url]
To:
Code:
[url=http://www.mydomain.com/goto/post?id=2564#post-2564]http://www.mydomain.com/goto/post?id=2564#post-2564[/url]
Of course the key is the msg and post id's but as we changing directly in the database we would like to make sure that it's really an internal URL changing . Checking on "www.mydomain.com" is one possible idea. Anyone that could give and exempla on how the SQL to make these changes would look like?

I found that the information is in table: xf_post and field:messages so the full link to the database would be:

mydatabase_db.xf_post.message

Thanks in advance
 
Last edited:

Jake Bunce

XenForo moderator
Staff member
#2
Use this addon:

http://xenforo.com/community/resources/post-content-find-replace.1549/

Quick Find: [url=http://www.mydomain.com/vin[/plain]

[b]Regular Expression:[/b] [plain]#\[url=http://www\.mydomain\.com/vin/[a-zA-Z0-9_\-]+/msg([0-9]+)/#msg[0-9]+\]([^\[]+)\[/url\]#siU

Replacement String: [url=http://www.mydomain.com/goto/post?id=\1#post-\1]\2[/url]



Quick Find: [url=http://www.mydomain.com/forum[/plain]

[b]Regular Expression:[/b] [plain]#\[url=http://www\.mydomain\.com/forum/index\.php?topic=[0-9]+\.msg([0-9]+)#msg[0-9]+\]([^\[]+)\[/url\]#siU

Replacement String: [url=http://www.mydomain.com/goto/post?id=\1#post-\1]http://www.mydomain.com/goto/post?id=\1#post-\1[/url]



That should do it.