Changing WordPress domain name without losing your rankings
Changing domain name touches the address stored in nearly every WordPress database table, the Search Console property, and every external link pointing at the old site. Without a precise method, some of the ranking value already earned gets lost needlessly.
Why the old domain doesn’t just disappear with a DNS change
Redirecting DNS to a new domain name isn’t enough: the old domain stays wrapped inside the WordPress database, embedded in serialised PHP data strings used for theme settings, widget configuration and certain plugin options. Serialised data prefixes every piece of text it holds with its exact character length. If you replace the old domain’s text with the new one through a plain SQL query, without recalculating that length, the declared value no longer matches the actual text: WordPress can no longer read the data back, and the affected setting resets or disappears, sometimes with no visible error for days.
That’s why the fix goes through a tool that recalculates these lengths on every replacement, such as the WP-CLI wp search-replace command, run on both the old domain (while it stays temporarily live) and the new one, rather than a direct text edit in the database.
On a WooCommerce shop, this also covers product and category URLs, whose structure needs to stay identical on the new domain so each redirect remains a direct match rather than a generic one. I also regenerate the sitemap.xml with the new URLs before submitting it to Search Console, and check that no menu or widget still hardcodes a link to the old domain.
How I change domain name without losing rankings
-
Replacing URLs on both sites
I run wp search-replace on a copy of the site with the new domain, while keeping the old domain temporarily live so existing access isn’t cut off during the transition.
-
Page-by-page 301 redirects
I set up a 301 redirect from every old-domain URL to its exact equivalent on the new one, never a blanket redirect to the homepage, which dilutes ranking value instead of passing it on, and I avoid chains of multiple redirects that slow down indexing.
-
Updating the Search Console property
I add the new domain as a separate property in Search Console and submit its sitemap, without deleting the old property until the redirects are confirmed live.
-
Reporting the address change
Where the tool allows it, I use Search Console’s change-of-address feature, which explicitly tells Google how the old and new domains relate.
-
Keeping the old domain live for several weeks
I keep the old domain name registered and pointed at the redirects for several weeks at minimum, long enough for Google to crawl the new URLs and pass on the ranking value already earned.
Going further
-
Guide: migrating without losing your rankings
The general method for preserving rankings during a migration, applicable beyond just a domain change.
-
Migrating hosting without downtime
The same serialisation mechanism applies during a host change, with its own switch-over method.
-
Moving a WordPress site to HTTPS
Another URL change that touches the same WordPress options and follows a similar correction logic.
-
Understanding PHP serialisation
The full definition of the mechanism that makes a plain SQL replace dangerous.
Describe your need in one minute
A few targeted questions so I can reply with an estimate rather than another questionnaire.