Update a domain in existing content?

peteGSX

New member
We've had to change the domain for our forum as the old one expired, and unfortunately the guy who registered it has health issues causing memory loss, and wasn't able to do anything about transferring ownership, and so we have migrated to a new domain.

Ideally I'd now like to go through our old forum posts with links to content and update those to point to the new domain. I've done some querying of the DB and it looks like there's less than 200 posts to update, but I haven't checked signatures etc. just yet.

I'm guessing the only way to do this is by either me (as admin) editing the posts, or updating the content via SQL queries, but does anyone have tips on any better ways to do it?
 
i have changed my forum domain a few times and changing link in post content has been one of the easier things to manage. there is a find/replace addon which i find complicated for this purpose though you should definitely check it out. if you are comfortable with something like phpmyadmin... there is a very simple query that would do the job. do take a backup and test thoroughly though. it should be pretty much ok if old domain is distinct.

UPDATE xf_post SET message = REPLACE(message, 'https://old.domain', 'https://new.domain');

since you would be replacing the entire protocol https://old.domain there are very little chances of messing this up. but do understand what query you are running and keep a few posts open beforehand to see how they appear after the command! AND BACKUP!

i do run this command frequently to fix common typos with brands so i think this is pretty safe. but yes... there are always risks with direct database manipulation so be careful. and of course wait for someone else to post first as there might be better ways.
 
Last edited:
Cheers, I had a feeling direct DB manipulation would be the way to go, and I'm pretty comfortable with PHPMyAdmin so no worries there.
 
Back
Top Bottom