MyBB Community Forums

Full Version: Change old URLs inside forum posts (posted as anchor text) to new URLs via PHPMyAdmin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to get my head around changing old URLs to new URLs in links WITHIN the actual posts of the forum. So there are hundreds of hyperlinks to other websites that have expired. I'd like to replace the URL in the hyperlinks to a new different URL in all affected posts. Say, from:

https://example.com (e.g. old link taking to expired website)

TO:

https://newexample.com (e.g. new link that is of use to visitors)


I've read that one should do this via PHPMyAdmin but there are several variables that I'm not sure of which to change. I'm playing around with PHPMyAdmin and, when I search for a given expired URL (that I want changed), it will give me all the results being found in the mybb_posts table (as expected) and the actual column in the mybb_posts table that houses the URL seems to be the 'message" column.

So far so good. But now I'd like to change the URL to a new URL. How? I've read different codes to use; one that seems to (maybe) work would be:


UPDATE mybb_posts SET message = REPLACE(message,'OLD TEXT','NEW TEXT') 

The old URLs that I'd like to change to new URLs are hyperlinked via MyCodes (hyperlinking option in text editor), hence the URLs are linked with anchor text as these two examples:

Old Example

New Example

So I'm not sure if the quoted code above may change the old URLs to the new URLs in the hyperlinked anchor text (or just the anchor text). That's if the above code works (don't know). There used to be a Search and Replace function in previous Cpanel versions, but not anymore.

I'd sincerely appreciate if you could shed some light on what MySQL/PHPMyAdmin code to use for this given purpose.

Likewise, I'd also appreciate if you could please let know how to backup the forum's database so that I could instantly put back a copy on Cpanel in case something goes wrong (I've read that DB backups taken from the MyBB admin console cannot be restored in Cpanel).

Many thanks!

EDIT: the forum's MyBB version is 1.6.x, not 1.8x

Update: so I've backed up the MySQL database via PHPMYADmin following the instructions on: https://docs.mybb.com/1.6/Database-Backup/

Incidentally, the actual MySQL database produced is smaller in size than the size shown for it on the MySQL option. Wonder what's that about and if this backed-up MySQL database will work in case I need to restore from it (is it a valid copy despite being 30% smaller and I didn't use any compressing to the final file?).

I'm still lost with how to go about changing the URLs in the actual posts of the forum. Don't know what code/syntax to use and there isn't much info specific to this particular issue in the forum.

Would really appreciate some help here. Many thanks.