I've changed the domain name of my forums site (with the old domain name still redirecting to the new one). One day the redirection from the old domain name will be disabled at which point all the in-post links to other forum topics will stop working. So I need to update the database to change the post_text field in the posts table.
I'm testing this on my testing service first, and I can get it to work for some of the text, but not the text in URL BBCode tags. Here's what I've got in my test post:
Code: Select all
This is a test. Please ignore.
Direct URL http://bushwalk-tasmania.com/forum/viewtopic.php?f=3&t=3080
Direct URL post http://www.bushwalk-tasmania.com/forum/viewtopic.php?f=3&t=3080
Between URL tags [url]http://bushwalk-tasmania.com/forum/viewtopic.php?f=3&t=3080[/url]
Between URL tags [url]http://www.bushwalk-tasmania.com/forum/viewtopic.php?f=3&t=3080[/url]
Inside URL tags [url=http://bushwalk-tasmania.com/forum/viewtopic.php?f=3&t=3080]Flying Toilets[/url]
Inside URL tags [url=http://www.bushwalk-tasmania.com/forum/viewtopic.php?f=3&t=3080]Flying Toilets[/url]
Code: Select all
UPDATE phpbb3_posts SET post_text = replace( post_text, "bushwalk-tasmania.com", "tasmania.bushwalk.com" ) ;
Code: Select all
This is a test. Please ignore.
Direct URL http://tasmania.bushwalk.com/forum/viewtopic.php?f=3&t=3080
Direct URL post http://www.tasmania.bushwalk.com/forum/viewtopic.php?f=3&t=3080
Between URL tags [url]http://bushwalk-tasmania.com/forum/viewtopic.php?f=3&t=3080[/url]
Between URL tags [url]http://www.bushwalk-tasmania.com/forum/viewtopic.php?f=3&t=3080[/url]
Inside URL tags [url=http://bushwalk-tasmania.com/forum/viewtopic.php?f=3&t=3080]Flying Toilets[/url]
Inside URL tags [url=http://www.bushwalk-tasmania.com/forum/viewtopic.php?f=3&t=3080]Flying Toilets[/url]
What is the comprehensive method of updating all links and references within all posts to point to the new domain name?
(of course it would be nice if when submitting a post, phpBB would detect same-domain links and convert them to relative links to avoid occurring in the first place)