How to Change Your WordPress Domain Without Losing SEO

Key Takeaways
- ✓Change WordPress Address and Site Address, or set WP_HOME and WP_SITEURL.
- ✓Use wp search-replace (skip the guid column), not a plain SQL replace.
- ✓301-redirect every old URL to the same path on the new domain.
- ✓Keep the old domain registered so its redirects keep working.
Table of Contents
- •How to Change Your WordPress Domain Without Losing SEO
- •Before You Start
- •Step 1: Change the WordPress Address and Site Address
- •Step 2: Replace the Old Domain in the Database
- •Step 3: Redirect Every Old URL (301)
- •Step 4: Tell Google
- •Step 5: Update Everything Outside WordPress
- •Common Problems
- •Frequently Asked Questions
- •Changing Domain and Host at the Same Time?
How to Change Your WordPress Domain Without Losing SEO
Changing a WordPress site’s domain takes three jobs: tell WordPress its new address, update the old address everywhere it’s stored in the database, and redirect every old URL to its new one so visitors and Google follow. Skip the third and you lose the search rankings the old domain earned. This guide walks through all three in order, with WP-CLI commands and the manual alternative.
Quick answer: back up, point the new domain at your hosting, run wp search-replace 'https://old.com' 'https://new.com' --skip-columns=guid, add a permanent (301) redirect from every old URL to the same path on the new domain, then use Google Search Console’s Change of Address tool.
Before You Start
Take a full backup of files and database.
Register the new domain and keep the old one. You’ll need the old domain to keep redirecting for a long time; don’t let it expire.
Point the new domain’s DNS at your hosting and add it to your hosting account, with an SSL certificate.
If possible, test on a staging copy first.
Step 1: Change the WordPress Address and Site Address
In the admin, go to Settings → General and change both WordPress Address (URL) and Site Address (URL) to the new domain, for example https://www.newdomain.com (with https and no trailing slash). Save. You’ll be logged out; log in again on the new domain.
If you can’t reach the admin, set them in wp-config.php instead:
define( 'WP_HOME', 'https://www.newdomain.com' );
define( 'WP_SITEURL', 'https://www.newdomain.com' );These override the database values without changing them, so do Step 2 as well and then remove the lines if you prefer settings in the database.
Step 2: Replace the Old Domain in the Database
Posts, menus, widgets and plugin settings store full URLs, so the old domain is still in hundreds of places. Replace it properly. Many plugins store data as PHP serialized strings, which break if you use a plain SQL find-and-replace, so use a tool that handles them.
With WP-CLI (recommended), do a dry run first:
wp search-replace 'https://olddomain.com' 'https://www.newdomain.com' --skip-columns=guid --dry-run
wp search-replace 'https://olddomain.com' 'https://www.newdomain.com' --skip-columns=guidRun it again for any other forms the old URL appears in, such as http://olddomain.com or https://www.olddomain.com. Skipping the guid column is deliberate: GUIDs identify posts to feed readers and shouldn’t change.
Without WP-CLI: a search-and-replace plugin that understands serialized data does the same job from the admin.
Then clear every cache: your caching plugin, any server cache and your browser.
Step 3: Redirect Every Old URL (301)
This is the step that protects your SEO. Each old URL should permanently redirect to the same path on the new domain, so olddomain.com/blog/post goes to newdomain.com/blog/post, not just to the home page.
On Apache, in the old domain’s .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteRule ^(.*)$ https://www.newdomain.com/$1 [R=301,L]On Nginx, a server block for the old domain:
server {
listen 80;
listen 443 ssl;
server_name olddomain.com www.olddomain.com;
# ssl_certificate lines for the old domain
return 301 https://www.newdomain.com$request_uri;
}The old domain needs a valid SSL certificate too, or visitors with https links see a warning before the redirect. Test a few deep URLs with curl -I https://olddomain.com/some-page and check for 301 and the right Location.
Step 4: Tell Google
Add and verify the new domain in Google Search Console.
In the old domain’s property, open Settings → Change of address and select the new domain. Google checks that your redirects work before accepting it.
Submit the new domain’s sitemap.
Expect rankings to wobble for a few weeks while Google recrawls. With complete 301 redirects in place, they usually settle at about where they were.
Step 5: Update Everything Outside WordPress
Email addresses and email DNS records (MX, SPF, DKIM) if email moves to the new domain.
Analytics, ads, social profiles and payment provider settings (webhook URLs, allowed domains).
Links you control on other sites.
CDN, firewall and any service that whitelists your domain.
Common Problems
Redirect loop: the WordPress URLs, the server redirect and a CDN disagree about http/https or www. Make them all point to one exact form.
Broken images or styles: the old domain is still in the database or in a page builder’s cache. Re-run the search-replace and regenerate the builder’s CSS.
Mixed content: some URLs are still
http://. See fixing mixed content on WordPress.Locked out after changing the URL: set
WP_HOMEandWP_SITEURLinwp-config.php.
Frequently Asked Questions
Will changing my domain hurt my SEO?
Temporarily, a little. With page-to-page 301 redirects, a Change of Address in Search Console and the old domain kept active, most sites recover their rankings within weeks.
How long should I keep the old domain?
As long as you can, at least a year. If the old domain expires, its redirects stop and any links pointing to it are lost.
Can I change the domain without WP-CLI?
Yes. Change the URLs in Settings → General and use a search-and-replace plugin that handles serialized data.
Why shouldn’t I replace URLs with a plain SQL query?
Plugins store settings as serialized PHP strings that record each string’s length. A plain SQL replace changes the length and corrupts those settings.
Do I need a new SSL certificate?
Yes, for the new domain, and keep a valid certificate on the old domain so https redirects work.
Changing Domain and Host at the Same Time?
RackUp’s team migrates WordPress sites for free. On Cloud WordPress hosting you also get 1-click staging with push/pull sync to test the change first and daily offsite backups with one-click rollback, from $2.49 a month. See plans. Moving hosts too? Read how to move WordPress to a new host.
Unsure Which Cloud Hosting Plan Fits Your Site?
Answer 4 quick diagnostic questions to estimate the server CPU, RAM and storage you need with transparent pricing.
Cloud Infrastructure Engineer.
Related Posts
WordPress HostingBluehost Alternatives (2026): WordPress Hosting Without the Renewal Price Jump
Bluehost's 2026 WordPress prices, what's included, and the alternatives for one site with monthly billing and the same price at renewal, with honest trade-offs.
WordPress HostingHostinger Alternatives (2026): WordPress Hosting Without Long Prepaid Terms
Hostinger's low WordPress price needs a 48-month prepay and renews higher. Its 2026 prices, what's included, and the alternatives, with an honest look at trade-offs.
WordPress HostingThe WordPress 5-Minute Install, Step by Step (2026)
WordPress's famous 5-minute install, step by step: requirements, database, file upload, wp-config.php, the web installer, WP-CLI and fixes for common install problems.