Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared Managed Cloud India
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Best lists Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Setup & site building · Guide

How to Change Your WordPress Domain

Short answer

To change your WordPress domain, point the new domain at your host, back up the site, then update the WordPress Address and Site Address in Settings > General. Replace the old address everywhere in the database with a tool that handles serialized data, such as WP-CLI search-replace. Add 301 redirects from the old domain and use Google Search Console's Change of Address tool to tell Google about the move.

Key takeaways

  • WordPress stores two URL settings: the WordPress Address, where core files live, and the Site Address, which visitors type.
  • A plain find and replace in a text editor can break serialized data in the database.
  • WP-CLI search-replace handles serialized data and leaves primary keys unchanged.
  • Google's Change of Address tool needs you to own both properties under the same Google account.
  • One sitemap file holds at most 50,000 URLs or 50 MB, according to Google Search Central.

What changes when you change a WordPress domain?

Changing your domain updates the address WordPress uses for the site, and it also means replacing the old address everywhere it appears in your content.

WordPress stores the address as two settings on the Settings > General screen. The Migrating WordPress guide from WordPress Developer Resources explains that the Site Address is the address visitors type, while the WordPress Address is where the core files live.

In most installs the two values match. They differ only when WordPress lives in a subfolder while the site itself opens at the domain root.

Changing the two settings alone does not fix links inside posts, image paths, or widget text. Those copies of the old address stay in the database until you replace them, which is why a domain change has several steps.

What do you need before you start?

You need a full backup, access to your hosting file manager or FTP, and the new domain already pointed at your host.

Back up both the files and the database before you touch any setting. If anything goes wrong, a backup is the only fast way back, and our guide to host backups explains what a host backup does and does not cover.

Point the new domain at your host with an A record or nameserver change at your registrar. DNS changes take time to spread, so read our guide on how long DNS propagation takes before you judge the result.

Make sure the new domain has an SSL certificate. The Migrating WordPress guide notes that both URL settings should include the https:// part and should not end with a slash.

How do you change the domain in the WordPress dashboard?

Open Settings > General, type the new address in both URL fields, and click Save Changes.

  1. Log in to wp-admin at the old domain.
  2. Go to Settings > General.
  3. Type the new address in WordPress Address (URL) and Site Address (URL), with https:// and no trailing slash.
  4. Click Save Changes, then log in again at the new address.

Use this method only when you can still log in and the new domain already points at the site. If you save a wrong address, the dashboard moves to an address that does not load, and you will need the file method below.

Both fields should include the https:// part and no trailing slash, according to the Migrating WordPress guide.

How do you change the domain with wp-config.php?

Add two define lines for WP_HOME and WP_SITEURL in wp-config.php, just above the line that says stop editing.

define( 'WP_HOME', 'https://new-domain.com' );
define( 'WP_SITEURL', 'https://new-domain.com' );

Edit wp-config.php in the site root with your host file manager or an FTP client. The WordPress Developer Resources guide on migrating WordPress gives these exact lines and says to place them above the comment that reads “That is all, stop editing! Happy publishing.”

Defining the URLs here hard-codes them, so the fields on Settings > General become greyed out. That is useful for a rescue, and you can remove the lines later to edit the settings in the dashboard again.

How do you fix a domain change that locked you out?

Add two update_option lines to your theme's functions.php, load the site once, then remove the lines right away.

update_option( 'siteurl', 'https://new-domain.com' );
update_option( 'home', 'https://new-domain.com' );

Open functions.php in the active theme, add the lines just after the opening <?php tag, and upload the file. Load the login page once, and the site should come back up at the new address.

The Migrating WordPress guide stresses that you must remove these lines after the site is working again. Leaving them in place keeps forcing the same values on every page load.

If you prefer the database, open phpMyAdmin, find the wp_options table, and edit the option_value of the siteurl and home rows. The same guide lists this as one of the four ways to change the URL, and it warns to back up the database first.

MethodBest whenWatch out for
Dashboard Settings > GeneralYou can log in and the new domain resolvesA typo can lock you out
wp-config.php definesYou are locked out or want a quick fixFields become uneditable in the dashboard
functions.php update_optionYou are locked out and have FTP accessRemove the lines after the site loads
phpMyAdmin wp_optionsYou are comfortable with the databaseBack up first; edit siteurl and home only
WP-CLI search-replaceYou need every old URL replaced in contentUse --dry-run first; skip the guid column

How do you replace the old domain everywhere in the database?

Use a tool that understands serialized data, such as WP-CLI search-replace or a migration plugin, and never edit a database export in a text editor.

WordPress stores some settings as serialized PHP, where each value carries its length. A plain find and replace changes the text but leaves the old length, which breaks widgets, theme settings, and Customizer data. The Migrating WordPress guide warns that this is exactly what a plain database search and replace can do.

WP-CLI search-replace handles this correctly. Its command reference states that it intelligently handles PHP serialized data and does not change primary key values.

wp search-replace 'https://old-domain.com' 'https://new-domain.com' --dry-run --skip-columns=guid
wp search-replace 'https://old-domain.com' 'https://new-domain.com' --skip-columns=guid

Run the dry run first. The --dry-run flag runs the whole operation and shows a report without saving changes, according to the same WP-CLI reference.

Skip the guid column. The WP-CLI handbook for hosts says the guid column should not be changed on an existing site, and its dry-run example shows the same flag.

If you have no command line access, a migration plugin can do the same job. Our guide to fixing broken links after migration covers what to check when a move leaves old URLs behind.

How do you set up redirects from the old domain?

Add a 301 redirect from every old URL to the matching new URL, and keep the old domain registered while the redirects run.

A 301 redirect tells browsers and search engines that a page moved for good. Without it, visitors who follow old links land on an error page, and search engines keep the old address in their index.

Set the redirects at your host or in .htaccess, one rule per URL pattern, so each old page points at its new twin. A single redirect from the old home page to the new home page is not enough for deep pages.

If redirects loop or clash, our guide to fixing too many redirects walks through the common causes.

Keep the old domain registered and the redirects live. Google's Change of Address help says to maintain the redirects for at least 180 days.

Keep paying for the old domain for at least a year so nobody else can buy it. Dropping the domain lets someone else register it, and every old link then points somewhere you do not control.

What should you update in Google Search Console?

Verify both the old and new properties in Search Console, run the Change of Address tool, and submit the new sitemap.

Google's Change of Address tool tells Google that your site moved from one domain to another. Use it only after the move and the redirects are in place.

Two rules limit the tool. You must own both the old and new properties under the same Google account, and the tool works only on domain-level properties, not on path-level ones, according to Google's help page.

Do not use the tool for an http to https move or a www to non-www move. Google's help page lists both as cases where the tool does not apply.

Then submit the sitemap for the new domain under Indexing > Sitemaps. Google's sitemap guide says a single sitemap is limited to 50 MB uncompressed or 50,000 URLs, so larger sites should submit a sitemap index file instead.

Submitting a sitemap is only a hint. The same guide notes that it does not guarantee Google will download the sitemap or use it for crawling.

How do you check the domain change worked?

Visit the new domain while logged out, log in to wp-admin at the new address, and click through pages, images, and links.

  • The home page and at least five inner pages load at the new domain.
  • Images show, with no mixed-content warnings in the browser.
  • Log in at new-domain.com/wp-admin and open Settings > General to confirm both URL fields.
  • Search the site for the old domain and fix any links that remain.

Re-save your permalinks under Settings > Permalinks. The Migrating WordPress guide notes that you must update .htaccess and permalinks after changing the address when rewrites are in use.

If the change involved a host move as well, our guide on changing hosting without losing SEO covers the extra steps.

What mistakes should you avoid?

Never edit the database by hand, never leave the RELOCATE line in wp-config.php, and never drop the old domain right after the move.

  • Plain text replacement in a database export breaks serialized values. Use a serialization-aware tool instead.
  • The RELOCATE constant is insecure if left in place. The Migrating WordPress guide warns that it lets an attacker change your site URL in some setups, so remove the line when you finish.
  • Do not chain site moves. Google's Change of Address help says that after you point site A at site B, you cannot at once point site B at site C.
  • The four manual methods are for single installs only. The Migrating WordPress guide states that multisite networks need the database edited by hand instead.
  • Changing the two URL settings does not move your files. If the site also moves to a new host, copy the files and the database first, then change the address.

Frequently asked questions

Can I change my WordPress domain without losing SEO?

Yes, if you redirect every old URL to its new twin with a 301 redirect and use the Change of Address tool in Search Console. Search engines then transfer most ranking signals to the new address. Keep the old domain and the redirects in place, and expect rankings to settle over days or weeks as Google recrawls the site.

How long does a WordPress domain change take?

The settings change takes minutes, but DNS can take hours to spread, and search engines need days or weeks to recrawl every page. Plan the move when traffic is low, and check the new domain from a fresh browser session before you announce it.

Do I need a new SSL certificate for the new domain?

Yes. Certificates are issued per domain, so the certificate for the old domain does not cover the new one. Ask your host to issue a certificate for the new domain before you change the URL settings, so visitors never see a security warning.

Can I change the domain on a WordPress multisite network the same way?

No. The manual URL methods in the WordPress migration guide are written for single installs only. A multisite network stores the domain in more tables, so you must edit the database by hand or use a migration tool that supports networks.

Will my images break after a domain change?

They can, if image URLs in posts still point at the old domain. Run a serialization-aware search and replace on the whole database, then open several posts and check that every image loads at the new address.

Sources

  1. Migrating WordPress WordPress Developer Resources
  2. wp search-replace WordPress Developer Resources
  3. WP-CLI Make WordPress Hosting
  4. Change of Address tool Google Search Central
  5. Build and Submit a Sitemap Google Search Central

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

WPLegible editors

Researched from the primary sources listed above and checked against our editorial rules. About the site · How we test