MyBB Community Forums

Full Version: Change all links in posts and signatures
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just changed my domain, How can I edit all posts and signatures in my forums that contains the old domain and replace it with the new one?

Let's say there are 100+ posts with forum links using the old domain

EXAMPLE

Hey dude, visit my fanfic in

www.olddomain.com/showthread.php######

How can I edit all posts only replacing www.olddomain.com

to www.newdomain.com?
try below sql queries (take a backup of the database before running sql queries)

UPDATE `mybb_posts` SET `message` = REPLACE (`message`, 'olddomain', 'newdomain') WHERE `message` LIKE '%olddomain%'; 
UPDATE `mybb_posts` SET `signature` = REPLACE (`signature`, 'olddomain', 'newdomain') WHERE `signature` LIKE '%olddomain%'; 


Run these queries:

UPDATE `mybb_users` SET `signature` = REPLACE (`signature`, 'http://www.olddomain.com', 'http://www.newdomain.com') WHERE `signature` LIKE '%http://www.olddomain.com%'

UPDATE `mybb_posts` SET `signature` = REPLACE (`signature`, 'http://www.olddomain.com', 'http://www.newdomain.com') WHERE `signature` LIKE '%http://www.olddomain.com%'

You should also cover users that don't put the www subdomain in the URL by running these queries:

UPDATE `mybb_users` SET `signature` = REPLACE (`signature`, 'http://olddomain.com', 'http://newdomain.com') WHERE `signature` LIKE '%http://olddomain.com%'

UPDATE `mybb_posts` SET `signature` = REPLACE (`signature`, 'http://olddomain.com', 'http://newdomain.com') WHERE `signature` LIKE '%http://olddomain.com%'

/ninja'd