- Two jobs, not one: rewrite URLs inside WordPress, and redirect every old URL outside it.
- Serialized data records its own length. A plain find-and-replace corrupts it when the new domain is longer or shorter.
- Never change the guid column. The WordPress handbook says GUIDs must stay permanent.
- Keep redirects for at least a year. That is Google’s general guidance; use the Change of Address tool for domain moves.
Changing a WordPress site’s domain is two separate jobs that people often treat as one. The first happens inside WordPress: every stored reference to the old address has to become the new one, without corrupting the data around it. The second happens outside: every old URL has to permanently redirect to its new equivalent, so visitors, links and search engines follow you.
Skip the first and you get broken images, layouts and settings. Skip the second and you lose traffic. This guide covers both. If you are also changing servers, read how to migrate WordPress to a new host alongside it.
How do you move WordPress to a new domain safely?
Rewrite the old domain in the database with a serialization-safe tool, set up page-to-page 301 redirects from the old domain, then tell Google with Search Console’s Change of Address tool. Keep the old domain registered and redirecting for at least a year. Google’s site-move guidance recommends keeping redirects as long as possible, generally at least one year.
Why a plain find-and-replace breaks WordPress
WordPress and many plugins store settings as serialized PHP data. A serialized string records its own length. For example, a logo URL stored in a theme setting might look like this:
s:25:"https://oldbrand.com/logo"
The 25 is the character count. A plain text replace to new-brand.com changes the text but not the number:
s:25:"https://new-brand.com/logo" ← now 26 characters: PHP can no longer read it
When PHP cannot unserialize a value, WordPress treats it as empty. Widgets disappear, theme options reset and page builder layouts break, often silently. The WordPress Advanced Administration Handbook warns about exactly this and recommends serialization-aware tools instead.
Two more formats catch people out:
- JSON-escaped URLs such as
https:\/\/oldbrand.com, common in block editor attributes and page builders. - URL-encoded URLs such as
https%3A%2F%2Foldbrand.com, found in some plugin settings and share links.
And one column must never change: guid in the posts table. The handbook is unambiguous that GUIDs identify posts permanently (feed readers rely on them), so leave them as they are.
Step by step: change the domain
1. Prepare the new domain
Register the domain, point DNS at the server that will host it, and issue an SSL certificate. Decide on one canonical version (with or without www) before you start.
2. Move the site and rewrite its URLs
Pick the route that matches your situation:
- New domain on a new server: install WordPress on the new domain, then migrate the site to it. With SwiftMigrate, generate a key on the new site and paste it into the old one. During the restore it rewrites the old address and server paths everywhere, including serialized, JSON-escaped and URL-encoded data, and skips the guid column. You can add extra find-and-replace pairs for an old CDN address or email domain.
- New domain on the same server: change the URLs with WP-CLI if you have shell access, previewing first:
Then run it again withoutwp search-replace 'https://oldbrand.com' 'https://new-brand.com' --skip-columns=guid --dry-run--dry-run, and updatehomeandsiteurlif they were not covered.
3. Fix what lives outside the database
- Hard-coded URLs in theme or child theme files, and in custom code snippets.
- CDN configuration, image optimization services and caching plugins that store the old hostname.
- The “From” address and SMTP settings for WordPress emails.
- Third-party embeds, payment gateway webhooks and API callbacks that point to the old domain.
4. Redirect every old URL to its new equivalent
Redirect page to page, not everything to the new homepage. If the path stays the same and only the domain changes, one rule on the old domain does it. On Apache (.htaccess on the old domain):
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?oldbrand\.com$ [NC]
RewriteRule ^(.*)$ https://new-brand.com/$1 [R=301,L]
On Nginx, in the old domain’s server block:
return 301 https://new-brand.com$request_uri;
Test a sample of old URLs, including posts, categories, images and the sitemap, and make sure each lands on the right new page in one hop.
5. Tell Google about the move
- Verify the new domain in Search Console, alongside the old one.
- Open the Change of Address tool on the old domain’s property and choose the new one. It runs pre-move checks, including on your redirects, before notifying Google. A request can be cancelled for 180 days.
- Submit the new XML sitemap.
- Watch both properties. Google says a medium-sized site can take a few weeks for most pages to move in its index, and larger sites longer.
6. Update everything that points to you
Update your Google Business Profile, social profiles, ad campaigns, analytics settings, email signatures and directory listings. Ask the sites behind your most valuable backlinks to update them; redirects carry visitors, but direct links are cleaner.
Mistakes that cost traffic after a domain change
- Redirecting everything to the homepage. Visitors and search engines lose the link between old and new pages.
- Using 302 (temporary) redirects for a permanent move.
- Redirect chains, such as old http → old https → new www → new non-www. Redirect straight to the final URL.
- Letting the old domain expire. Redirects stop, and someone else can buy it. Keep it registered and redirecting for at least a year, ideally indefinitely.
- Changing the domain, design and URL structure at once. If traffic drops, you cannot tell which change caused it. Change one thing at a time where you can.
Use our WordPress migration checklist to run the move in order. For domain changes on sites where organic traffic matters, our technical SEO team can build the redirect map and monitor the transition. More guides are in our WordPress migration guide.
Frequently asked questions
Will changing my WordPress domain hurt SEO?
There is usually a period of fluctuation while Google processes the move, which Google says can take a few weeks for a medium-sized site. Page-to-page 301 redirects, the Change of Address tool, an updated sitemap and keeping redirects for at least a year minimise the impact.
Can I just change the URL in Settings → General?
That changes only the home and site URL options. Links, images and settings stored throughout the database still point to the old domain, and the old URLs are not redirected. Use it together with a serialization-safe search and replace and server-side redirects.
What is serialized data in WordPress?
It is PHP’s format for storing arrays and objects as text, used for many theme and plugin settings. Each string records its length, so changing a URL to one of a different length without updating that number makes the value unreadable.
How long should I keep redirects from the old domain?
Google’s guidance is as long as possible, generally at least one year. Many sites keep them indefinitely, because old links keep sending visitors.
Can SwiftMigrate change the domain during a migration?
Yes. Install it on a WordPress site at the new domain and migrate the old site to it. It rewrites the address and server paths, including serialized, JSON-escaped and URL-encoded data, and leaves the guid column alone. Redirects on the old domain and the Search Console steps still need to be done separately.
Move the site and rewrite its URLs in one go
Install SwiftMigrate on both sites from WordPress.org. Serialization-safe URL rewriting, verification before restore and one-click rollback.
Get it on WordPress.org ↗Sources and further reading
This article was reviewed against current primary documentation available on October 3, 2026.