All posts
Blog

How to Change Your WordPress URL Without Breaking Your Site

By Dakshesh11 min read

  • wordpress
  • wordpress maintenance
  • technical SEO
  • website monitoring
Continue with GoogleFree plan · No credit card required

Listen to this article

13 minute listen

Narrated by an AI voice · 14 chapters

0:00-12:37

AI Overview

To change your WordPress URL, back up your site, then update the WordPress Address and Site Address in Settings > General, or set WP_HOME and WP_SITEURL in wp-config.php if you're locked out. Next, replace the old URL across the database with WP-CLI search-replace, add 301 redirects, and update Google Search Console.

Key takeaways

  • Back up and make sure the new address works before changing any setting.
  • WordPress Address is where core files live; Site Address is what visitors use.
  • wp-config.php constants override the database and fix most lockouts.
  • Settings alone don't update saved links, so run a serialization-safe search-replace.
  • 301 redirects and Search Console's Change of Address protect your rankings.

Free WordPress plugin

Know which plugin update broke your site.

The free MyKavo plugin watches your site through every plugin, theme and core update, and tells you which one caused a change, before your visitors find it.

  • Records every plugin, theme and WordPress update
  • Checks your key pages right after each update and names the one that broke something
  • One-click rollback when an update goes wrong, free
  • Changes, alerts and before-and-after proof inside wp-admin

Free on WordPress.org · WordPress 6.2+ · PHP 7.4+ · The check after each update comes with every paid plan

Summarize with AI

Opens the assistant in a new tab with a link to this post.

On this page

To change your WordPress URL, go to Settings > General, update the WordPress Address (URL) and Site Address (URL), and save. That changes the address WordPress uses, but on its own it doesn't update links already saved in your posts, redirect old URLs or tell Google about the move. A clean URL change also needs a search-and-replace on the database and 301 redirects from the old address.

This guide covers every way to change the site address: the Settings screen, wp-config.php, a functions.php fallback for when you're locked out, and WP-CLI search-replace for moving from HTTP to HTTPS or to a new domain. It finishes with redirects, Search Console's Change of Address tool, and a checklist for after the switch.

Changing your site address? The free MyKavo WordPress plugin checks your pages after every update and shows exactly what changed, from redirects to canonicals. Start monitoring free.

Quick answer: how to change your WordPress URL#

  1. Back up your files and database before touching anything.
  2. Make sure the new address works first: the domain points to your server and an SSL certificate is active if you're moving to HTTPS.
  3. Update the two URLs in Settings > General, or set WP_HOME and WP_SITEURL in wp-config.php if you can't reach wp-admin.
  4. Replace the old URL in the database with wp search-replace or a search-and-replace plugin, running a dry run first.
  5. Add 301 redirects from every old URL to its new equivalent.
  6. Tell Google: add the new site to Search Console, submit your sitemap, and use the Change of Address tool if you moved to a new domain.
  7. Check key pages, forms and logins, then clear all caches.

Before you start: back up and prepare#

Changing the site address is one of the few WordPress settings that can lock you out instantly. If you type a wrong URL and save, the next page load goes to an address that doesn't work.

  • Take a full backup of files and database. Our WordPress backup guide covers plugin, host and manual options. With WP-CLI, wp db export creates a database file in seconds.
  • Point the new domain at your server (DNS) and add it to your hosting account before changing WordPress.
  • Install an SSL certificate for the new address if it uses HTTPS.
  • Know how to reach your files over FTP, SFTP or your host's file manager, in case you need the fallback methods below.

If you're also moving to a new host, read our website migration guide first, because the order of steps changes.

WordPress Address vs Site Address#

Settings > General has two URL fields, and they do different jobs:

FieldOption name in the databaseWhat it controls
WordPress Address (URL)siteurlWhere WordPress core files live, including wp-admin and wp-login.php
Site Address (URL)homeThe address visitors type to reach your site

On most sites, both are identical, such as https://example.com. They only differ when WordPress is installed in a subfolder (for example https://example.com/wp) but the site is served from the root domain.

Method 1: Change the URL in Settings > General#

Use this when you can log in and the new address already works.

  1. Go to Settings > General.
  2. Change WordPress Address (URL) and Site Address (URL) to the new address, such as https://example.com.
  3. Don't add a trailing slash.
  4. Click Save Changes.
  5. WordPress logs you out. Log in again at the new address, such as https://example.com/wp-admin.

If the fields are greyed out, the URLs are set in wp-config.php (Method 2), and you'll need to change them there.

Method 2: Set WP_HOME and WP_SITEURL in wp-config.php#

Defining the URLs in wp-config.php overrides the database values. It's the quickest fix if you're locked out because of a wrong URL.

  1. Open wp-config.php in your site's root folder over FTP or your host's file manager.
  2. Add these lines above /* That's all, stop editing! Happy publishing. */:
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
  1. Save the file and load the site.

While these constants are set, the two fields in Settings > General are greyed out. You can leave them in place permanently, which also stops anyone changing the URLs from wp-admin. If you remove them later, the database values apply again, so make sure those are correct first.

Method 3: The functions.php fallback#

If you can't use wp-config.php, WordPress's documentation describes a one-time fix using your active theme's functions.php. It writes the new values to the database.

  1. Connect over FTP and open wp-content/themes/your-active-theme/functions.php.
  2. Add these lines right after the opening <?php line:
update_option( 'siteurl', 'https://example.com' );
update_option( 'home', 'https://example.com' );
  1. Load the login page or front end a couple of times.
  2. Remove the lines again. They run on every page load while they're there.

If you're unsure which theme is active, check the template and stylesheet rows in the wp_options table, or use Method 2 instead.

Try it on your site · free

Check your own page's meta tags

Title, description, canonical and robots - including an accidental noindex - in a few seconds.

Open the full tool

Method 4: WP-CLI search-replace (HTTP to HTTPS or a new domain)#

Changing the two settings doesn't touch the URLs saved inside your content: image paths, internal links, menu items, widget settings and page builder data all still point at the old address. That's what causes mixed content warnings after an HTTPS switch and broken images after a domain move.

WP-CLI's search-replace fixes this safely. It handles serialized data, which a plain SQL find-and-replace would corrupt.

# 1. Export a backup of the database first
wp db export before-url-change.sql

# 2. Dry run: shows what would change without changing anything
wp search-replace 'http://example.com' 'https://example.com' \
  --skip-columns=guid --dry-run

# 3. Run it for real
wp search-replace 'http://example.com' 'https://example.com' \
  --skip-columns=guid

# 4. Flush caches and rewrite rules
wp cache flush
wp rewrite flush

For a domain move, replace the old domain with the new one:

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

A few tips:

  • Include the protocol (https://) in both strings so you don't change unrelated text, such as an email address on the old domain.
  • Run separate passes if your content mixes www and non-www versions.
  • --skip-columns=guid leaves post GUIDs alone; WordPress uses them as permanent identifiers, for example in feeds.
  • Custom tables: by default the command searches tables registered with WordPress. Add --all-tables-with-prefix to include plugin tables that use your prefix.
  • Multisite needs extra care: add --network or --url= and update the domain values for each site. Test on a copy first.

No SSH? Plugins such as Better Search Replace do the same job from wp-admin and also handle serialized data. Elementor also has Elementor > Tools > Replace URL for its own data.

Step 5: Set up 301 redirects#

Without redirects, every old link, bookmark and Google result leads to an error, and the old URLs' ranking signals aren't passed to the new ones. Use 301 (permanent) redirects, not 302s. Our guide to 301 vs 302 redirects explains why.

Force HTTPS (Apache .htaccess)#

Add this above the # BEGIN WordPress block in .htaccess:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

Redirect an old domain to a new one (Apache)#

Keep the old domain pointed at a server with this in its .htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?old-domain\.com$ [NC]
RewriteRule ^(.*)$ https://new-domain.com/$1 [R=301,L]

Nginx#

server {
    listen 80;
    listen 443 ssl;
    server_name old-domain.com www.old-domain.com;
    # ssl_certificate lines for the old domain go here
    return 301 https://new-domain.com$request_uri;
}

Redirect page to page, not everything to the homepage. Each old URL should go to its exact equivalent. Many hosts and Cloudflare also offer redirect rules in their dashboards. For page-level redirects inside WordPress, see how to redirect a page in WordPress.

Test a sample of old URLs with the free redirect chain checker. Each should reach the new page in one 301 hop, not a chain. If the browser shows "too many redirects", see our guide to ERR_TOO_MANY_REDIRECTS.

Step 6: Tell Google about the change#

  1. Add and verify the new site in Google Search Console. A Domain property covers all protocols and subdomains.
  2. Submit your XML sitemap for the new address.
  3. For a new domain, use the Change of Address tool. In the old property, go to Settings > Change of address, pick the new property and submit. Google checks that you own both sites and that a few pages return 301 redirects.
  4. Don't use Change of Address for HTTP to HTTPS or for www vs non-www changes. Google's documentation says to rely on redirects for those.
  5. Keep redirects in place long term. Google's site move guidance recommends keeping them for at least a year, and longer is safer.

Also update the URL everywhere else it appears: Google Analytics data stream settings, Google Business Profile, social profiles, email signatures, ad campaigns and any CDN or firewall settings.

After-change checklist#

CheckWhy
Log in at the new /wp-adminConfirms siteurl is correct
Browse key pages in a private windowCatches cached or broken pages
Look for mixed content warningsLeftover http:// assets
Test contact forms and checkoutPlugins sometimes store full URLs
Check images and mediaOld paths left in content
Test old URLs redirect in one hopPreserves traffic and rankings
Check canonical tags point to the new domainWrong canonicals confuse Google
Clear plugin, host and CDN cachesStale pages show the old URL
Update sitemap in Search ConsoleSpeeds up recrawling

How to catch URL change problems automatically#

A URL change touches almost every page, and the problems are rarely visible from wp-admin: a canonical still pointing at the old domain, a redirect that turned into a chain, an analytics script that stopped loading, a page that now returns a 404.

MyKavo monitors the pages you pick and alerts you when HTTP status, redirects, canonical, title, meta description, robots meta, scripts or broken internal links change, with before-and-after proof and a severity. It also checks each site is up every 5 minutes and warns before your SSL certificate expires. Once the move is done and verified, approve the changes as the new baseline. The free MyKavo WordPress plugin keeps checking your pages after every plugin, theme and core update.

Frequently asked questions#

Frequently asked questions

How do I change my WordPress site URL?

Go to Settings > General, update the WordPress Address and Site Address, and save. Then replace the old URL in your database with WP-CLI search-replace or a search-and-replace plugin, add 301 redirects, and update Google Search Console.

What is the difference between WordPress Address and Site Address?

WordPress Address (siteurl) is where WordPress core files and wp-admin live. Site Address (home) is the URL visitors use. They're usually the same unless WordPress is installed in a subfolder.

How do I change the WordPress URL if I'm locked out?

Add define('WP_HOME', 'https://example.com') and define('WP_SITEURL', 'https://example.com') to wp-config.php over FTP, or with SSH run wp option update home and wp option update siteurl with the correct address.

Why are the WordPress Address fields greyed out?

The URLs are defined in wp-config.php with the WP_HOME and WP_SITEURL constants. Change them in wp-config.php, or remove the constants so the Settings fields become editable again.

Will changing my WordPress URL hurt SEO?

It can cause a temporary dip, but 301 redirects from every old URL to its new equivalent pass most signals across. Keep redirects in place long term, update canonicals and sitemaps, and use Search Console's Change of Address tool for domain moves.

Do I need to update links in my posts after changing the URL?

Yes. Settings > General doesn't change URLs saved in content, menus or widgets. Run wp search-replace or a plugin such as Better Search Replace to update them, after a backup and a dry run.

The bottom line#

Changing a WordPress URL is more than editing two fields. Back up first, make sure the new address works, update the URLs in Settings or wp-config.php, replace the old address throughout the database with a serialization-safe tool, and redirect every old URL with a 301. Then tell Google, check your key pages, and keep watching them for the weeks after the move.

Make sure nothing broke in the move. Start monitoring your site free with MyKavo and install the free MyKavo WordPress plugin, no card needed.

Share this post

Write for MyKavo

Know website monitoring, WordPress or SEO from real work? Pitch us a guide. You keep a byline with one link to your site. Read the guidelines

Get alerted when your site breaks. Free, no card.

Start free