Moving a WordPress site to a new domain

WordPress stores its own address in the database in many places, so a domain change is more than pointing DNS.

The serialisation trap – read this first

Do not run a plain find-and-replace over a database dump. WordPress stores much of its data serialised, and serialised data records the length of each string. Change example.com to example.co.uk with a blunt replace and every string length is now wrong, so those settings silently fail to load – widgets vanish, theme options reset, plugin settings revert.

Use a tool that understands serialisation: WP-CLI's search-replace, or one of the well-known search-and-replace scripts, or a migration plugin. They rewrite the lengths correctly.

The order

  1. Copy files and database to the new location and get it working before changing DNS – use your hosts file to preview it
  2. Run a serialisation-aware search and replace for the old address
  3. Update Site Address and WordPress Address
  4. Save permalinks to rewrite .htaccess
  5. Point DNS, then confirm the certificate is issued for the new name

Do not forget

  • Redirect the old domain permanently to the new one, and keep it
  • Update analytics and search console
  • Check any hard-coded URLs in theme files and custom fields
  • Re-test contact forms and any payment integration, since callbacks often carry the old address
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Why WP-Cron is disabled on our servers, and what replaces it

WordPress has its own scheduling system, WP-Cron, which runs scheduled tasks – publishing...

Object caching, and why Redis is not available here

WordPress can store the results of database queries in memory so that repeated requests do not...

Moving an existing WordPress site to us

A move goes wrong in predictable ways. Doing it in this order avoids all of them. 1. Set the...

The white screen of death: how to diagnose it

A completely blank page means PHP stopped part-way through and had nothing to show. The page...

Locked out of wp-admin: how to get back in

There are several routes back in depending on what is wrong. All of them need cPanel access, so...