How To Change Your WordPress URL

How To Change Your WordPress URL

Last modified: May 18, 2026

FAQ
Fiverr freelancers

Changing your WordPress URL is a multi-step process that touches several files and settings. Done carefully and in the right order, it is a clean migration. Done out of order — or without a backup — it can leave your site inaccessible. This guide covers all four required steps, plus a fifth step that most tutorials skip: updating the old URLs still embedded in your database.

Before starting, confirm why you need to change the URL. Common reasons include rebranding, new ownership, moving from HTTP to HTTPS, or switching from a subdomain (staging.yoursite.com) to the main domain. If you are only switching from HTTP to HTTPS, that is a separate process — changing the URL in Settings alone will not handle an SSL migration correctly.

Show More

* This button will show the rest of the post and open up an offer from a vendor

Step One: Backup

Before touching any WordPress settings or files, take a complete backup of your site. If something goes wrong mid-process, a backup is the only way to restore without losing data.

You need two things backed up:

  • Your database — this contains all your posts, pages, settings, and user data. This is the critical one.
  • Your files — the WordPress core, theme files, plugins, and uploaded media in wp-content/.

The easiest way is to use a WordPress backup plugin like UpdraftPlus or All-in-One WP Migration. Run a full backup, download the backup files to your computer, and confirm the download is complete before proceeding.

If you prefer a manual approach: export the database from phpMyAdmin (available in your hosting control panel), and download your wp-content folder via FTP. Store both files somewhere safe — not just on the server you’re working on.

Do not skip this step. URL changes can make your WordPress admin temporarily inaccessible, and if something goes wrong in the wp-config.php or .htaccess file, having a backup means the recovery is a few minutes, not hours.

Step Two: Change The URL Within Your WordPress Dashboard

Log into your WordPress admin and go to Settings > General.

In this screen, you will see two URL fields:

  • WordPress Address (URL) — the URL where WordPress core files are installed
  • Site Address (URL) — the URL visitors use to reach your site

Update both fields to your new URL (for example, change http://oldsite.com to https://newsite.com). Make sure they match exactly, including whether you use www or not. Click Save Changes.

Important: once you click Save Changes, WordPress will immediately redirect to the new URL. If the new URL is not yet configured correctly (DNS, SSL, or wp-config.php), you will not be able to access the admin dashboard until you fix it in the next step. Have your FTP credentials ready before saving.

Step Three: Change The Domain In The wp-config.php File

If you are locked out after the previous step — or want to set the URL before going through the dashboard — you can define it directly in wp-config.php.

Connect to your server using an FTP client (your hosting control panel will have the FTP credentials). Navigate to your site’s root folder and open wp-config.php in a text editor.

Add these two lines anywhere before the line that reads /* That's all, stop editing! Happy blogging. */:

define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');

Replace example.com with your actual new domain, and make sure to use https:// if your site has an SSL certificate. Save the file and upload it back to the server. WordPress should now load at the new URL and your admin access should be restored.

Step Four: Setup Redirects

Once the URL is updated, set up 301 redirects from the old domain to the new one so that external links and bookmarks continue to work and so search engines transfer any ranking signals to the new URL.

Connect via FTP again and locate the .htaccess file in your site’s root folder. Open it in a text editor and add the following code at the top (above the existing WordPress rewrite rules):

#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

Replace example.com with your new domain. Save the file and upload it back to the server.

To verify the redirect is working, visit your old URL in a browser (or use a tool like httpstatus.io) and confirm it resolves to the new domain with a 301 status code.

Step Five: Update Internal URLs in the Database

This is the step most tutorials skip — and the most common cause of broken images, links, and layout issues after a URL change.

When you change your WordPress URL, all the content in your database still contains references to the old URL: image paths, internal links in posts, widget settings, and theme option values. These do not update automatically.

To fix this, you need to run a search-and-replace on your database, swapping the old URL for the new one.

Using a plugin: A URL replacement plugin (search the WordPress plugin directory for “search replace URL” or “better search replace”) can handle this without touching the database directly. Install it, enter your old URL in the search field and your new URL in the replace field, select all tables, and run a dry run first to preview what will change. Then run the live replacement.

Using WP-CLI (if available on your host):

wp search-replace 'https://oldsite.com' 'https://newsite.com' --all-tables

After running the replacement, clear your WordPress cache if you use a caching plugin, then check several posts and pages to confirm images load correctly and internal links resolve to the new domain.

After Changing Your WordPress URL: What to Check

Once all four steps are complete, run through this checklist to confirm everything is working correctly:

  • Visit your new URL in a browser — the site should load without redirect loops
  • Log into your WordPress admin at the new URL (/wp-admin)
  • Check Settings > General to confirm both URL fields show the new domain
  • Open a few posts and pages — confirm images load and internal links point to the new domain
  • Test your old URL — confirm it redirects to the new domain with a 301 (use httpstatus.io to verify the status code)
  • If you use Google Search Console, add the new URL as a property and submit your sitemap

Changing your WordPress URL is a careful, sequential process — but when done properly, your site and its content should transfer cleanly to the new domain.

Recap:
Save 4 Later
Email liked links to yourself

    Stay Updated with WordPress Insights

    Get the latest WordPress tips, theme reviews, and industry deals delivered to your inbox.