I migrated my WordPress site to a new host and new URL.
I’ve done all the typical search and replace in mysql and the site works great.

However, the links of my images are all missing .co.uk, thus not working.

Image below

The odd thing is, all the image URLs are correct in the source code of blogs. But in my media library, they are all missing .co.uk.

How do I add .co.uk back into my media library URLs?

6 Answers
6

As mentioned in the comments under your question, some data in the WordPress database is serialized and therefore not possible to change with a simple find and replace.

You should read through the Moving WordPress section of the codex. Specifically the Changing Your Domain Name and URLs portion. I usually use a plugin or a command line tool depending on what’s available to me.

Plugin:

Better Search Replace is a useful plugin recommended in the entry above. There are other plugins that will do the same things but this is my preference. Some features that I enjoy are:

  • Support for serialized data.
  • The ability to select single or multiple tables.
  • A “dry run” feature to test and verify your changes before actually performing them.
  • Very few server requirements (all you need is a WP instance.)

CLI Tool:

Another option that handles serialized data is the WP-CLI’s search-replace tool. This option is used from the command line via something like SSH and requires the wp-cli to be installed on the server. You can take a look at the docs for all available options and examples but the basic usage is:

# Search for old domain name and replace it with a new one
$ wp search-replace 'http://old.example.dev' 'http://new.example.com'

Leave a Reply

Your email address will not be published. Required fields are marked *