I recently migrated domains and in my database, I had stored full paths containing the old domain, which now broke 🙂
What I need to do is change values in the database table from
http://www.olddomain.com/img/some/path
to
http://www.newdomain/same/dir/structure/as/old/domain
The only caveat is that the photo names at the end of the url must be preserved. So essentially, I have to just change the host name.
Is that possible to do? If so, how? 🙂
Try this:
UPDATE table SET column = REPLACE(column,"www.olddomain.com","www.newdomain.com");ALWAYS make sure you do a backup of your database before running a query that updates many records (as this will).