Updating the database for a new address.
THE STEPS
- Back up the database.
- Update the site URL values.
- Run a serialisation-aware search and replace across the whole database.
- Clear caches.
- Re-save permalinks.
- Check a sample of pages, images and links.
WHAT TO REPLACE
The full old URL including scheme, to the full new one.
Also check for references without the scheme, and for the bare domain.
WHY A PLAIN SQL REPLACE FAILS
Serialised data records the length of each stored string. Changing the text without updating the lengths corrupts the value.
Widget settings and plugin configuration are commonly stored this way, and they fail silently.
THE TOOLS THAT WORK
A search-replace plugin that handles serialisation
WP-CLI
A dedicated search-replace script
CHECKING AFTERWARDS
Search the database for the old domain. Anything remaining is somewhere the tool did not reach, typically a configuration file rather than the database.
THE SEO SIDE
Every old URL needs a 301 redirect to its new equivalent, or the search traffic is lost.