Changing the WordPress site URL safely requires updating the correct settings, protecting access to your dashboard and checking that your website continues to work afterwards. The process differs depending on whether you are switching from HTTP to HTTPS, changing your domain name, moving WordPress into another directory or correcting an incorrect URL.
Before making changes, create a complete backup of your website’s files and database. A mistake in the URL configuration can make both the public website and the WordPress dashboard inaccessible until the settings are corrected.
Understand the WordPress Address and Site Address
WordPress provides two URL settings under Settings → General. They often contain the same address, but they serve different purposes.
WordPress Address (URL)
The WordPress Address identifies the directory containing the WordPress core files, including wp-admin, wp-content and wp-includes.
For example, if WordPress is installed in a directory named wordpress, the address might be:
Site Address (URL)
The Site Address is the public address visitors use to reach your website.
If WordPress is installed in its own directory but configured to serve the website from the domain’s root, the settings could be:
| Setting | Example |
|---|---|
| WordPress Address (URL) | https://example.com/wordpress |
| Site Address (URL) | https://example.com |
These values are only an example of a WordPress installation configured to use a separate directory. For a standard installation in the domain’s root, both settings would usually be https://example.com.
Do not automatically make both URLs identical. First establish where the WordPress files are installed and which address should serve the public website.
Prepare your website before changing its URL
A safe URL change starts with preparation. This is particularly important when changing domains or moving an established website.
Create a complete backup
Back up both the WordPress files and the database. The files contain WordPress, themes, plugins and uploaded media, while the database contains posts, pages, settings and other site data.
Store the backup somewhere separate from the live website and confirm that it can be restored if necessary.
If your hosting provider offers a staging environment, use it to test a significant domain or directory change before applying it to the live website.
Confirm the new address is ready
Before changing the settings, establish the exact URL you intend to use.
Check that:
- The domain points to the correct hosting environment if you are changing domains.
- The intended WordPress files are present in the correct directory.
- HTTPS is configured and the certificate is valid if the new address uses
https://. - You have access to your hosting control panel or file manager in case the dashboard becomes inaccessible.
- You can access the database or a suitable recovery mechanism if necessary.
If you are changing only the protocol from HTTP to HTTPS, make sure HTTPS works before updating WordPress to use it.
Check for configuration overrides
Some installations define WP_HOME or WP_SITEURL in wp-config.php. These constants override the corresponding database settings and can prevent changes from being made through the General Settings screen.
If either constant is present, identify its purpose before proceeding.
How to change the WordPress site URL from the dashboard
This is the simplest method when you can still access your WordPress dashboard and are changing the address without moving the WordPress files.
- Compare backup and staging tools
- A simpler path for your next migration
- Less stress on update day
Step 1: Open General Settings
Sign in to WordPress and navigate to Settings → General.
Locate these fields:
- WordPress Address (URL)
- Site Address (URL)
If the fields are locked or cannot be edited, check whether WP_SITEURL or WP_HOME is defined in wp-config.php.
Step 2: Enter the correct URLs
Replace the existing values with the intended addresses. Include the protocol, such as https://, and omit the trailing slash.
For example, to change a website from HTTP to HTTPS:
- WordPress Address (URL):
https://example.com - Site Address (URL):
https://example.com
Use your actual domain and installation path. Do not copy the example addresses literally.
If you are changing the domain name, make sure the new domain already points to the correct website environment. If WordPress is installed in a subdirectory, preserve that path in the WordPress Address where appropriate.
Step 3: Save the changes
Select Save Changes.
WordPress may log you out or redirect you to the new address. If that happens, open the new URL and sign in again.
If the website or dashboard stops working, do not repeatedly change settings at random. Use the recovery methods described below.
How to change the site URL using wp-config.php
If the dashboard fields are unavailable or you need to override an incorrect URL, you can define the addresses in wp-config.php. This file is located in the WordPress installation directory.
Use your hosting control panel’s file manager or secure file access to edit it. Download a backup copy before making changes.
Add the URL constants
Open wp-config.php and locate the comment that says /* That's all, stop editing! Happy publishing. */.
Add the following lines before that comment, replacing the example addresses with your actual URLs:
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
Save the file and check whether the website and dashboard now use the intended addresses.
These constants override the corresponding database values; they do not update those stored values. While the constants remain in place, the URLs generally cannot be changed through the dashboard. Removing them later can cause WordPress to revert to the database values if those still contain the old addresses.
Use this method carefully. If you are simply migrating a website to a new domain, changing these constants alone does not update old URLs stored in posts, settings or plugin data.
How to recover if changing the URL breaks WordPress
If the site becomes inaccessible after changing its URL, you can usually restore access through the hosting file manager or database tools.
Option 1: Correct wp-config.php
If you added WP_HOME or WP_SITEURL, reopen wp-config.php and check for spelling errors, incorrect domains, mismatched protocols or missing directory paths.
Correct the values or temporarily remove the constants if you need to restore control to the database settings. Remember that the database must also contain valid URLs for this to work.
Option 2: Correct the database values
If you cannot access the dashboard, a database management tool such as phpMyAdmin can be used to correct the stored values.
- Back up the database before editing it.
- Open the database used by your WordPress installation.
- Find the options table, commonly named
wp_options. The table prefix may differ on your installation. - Locate the rows whose
option_namevalues arehomeandsiteurl. - Update their
option_valuevalues to the appropriate addresses. - Save the changes and try accessing the correct login URL.
For a standard root installation, both values might be https://example.com. If WordPress is installed in a subdirectory, siteurl may need to include that directory while home uses the public address.
Do not use this procedure without checking for configuration constants that override the database values. On a WordPress Multisite installation, the configuration is more complex and these single-site instructions should not be applied blindly.
What to do when changing your domain name
Changing the site’s URL from one domain to another involves more than editing two settings. WordPress content, plugin options, navigation links and other database records may still refer to the old domain.
For example, a move from https://old-example.com to https://new-example.com may require updating references throughout the database.
Update old URLs safely
Use a search-and-replace method that understands WordPress’s serialised database data. Some themes and plugins store settings in a format that records the length of text values. A basic database-wide text replacement can corrupt those values.
Suitable approaches include:
- WP-CLI: Use its
search-replacecommand if you have access to the command-line tool. - A reputable WordPress search-and-replace plugin: Choose one that explicitly supports serialised data and use a preview or dry run where available.
- A migration tool: Use a suitable tool as part of a documented migration process.
WordPress documents these options in its official migration guidance.
If using WP-CLI, first check the results without making changes:
wp search-replace 'https://old-example.com' 'https://new-example.com' --skip-columns=guid --dry-run
Review the proposed replacements carefully. If the results are correct, run the command again without --dry-run:
wp search-replace 'https://old-example.com' 'https://new-example.com' --skip-columns=guid
Run these commands from the correct WordPress installation and use the exact old and new URL strings appropriate to your migration. The --skip-columns=guid option avoids changing the GUID column, which WordPress advises should remain unchanged. If the old domain also appears with other protocols or URL variants, those may need separate review.
Set up redirects from the old domain
If you have changed domains, configure permanent redirects from the old URLs to their corresponding new URLs where possible. Redirects help visitors and search engines reach the replacement pages instead of encountering broken links.
Avoid redirecting every old URL to the new homepage when a relevant destination exists. Map old pages to their equivalent new pages and test the redirects to ensure they work correctly.
Keep the old domain and its redirect configuration active for an appropriate transition period, and update important references such as internal links, canonical URLs, XML sitemaps and external service settings.
Final checks after changing the WordPress URL
After making the change, verify that the website works from both the public and administrative sides.
- Open the homepage and several important pages.
- Sign in to the dashboard using the new address.
- Confirm that HTTPS works correctly if you changed the protocol.
- Test navigation menus, internal links and uploaded media.
- Open Settings → Permalinks and save the existing structure if necessary to refresh rewrite rules. Do not change the structure unnecessarily.
- Check for redirect loops, mixed-content warnings and links that still use the old domain.
- Test forms, login flows, e-commerce checkout and other important functionality.
- Check the site’s canonical URLs and sitemap if the domain has changed.
- Review any caching, CDN, SSL or security configuration that depends on the old address.
If the migration affects a live website, monitor errors and broken links after the change. Keep your backup until you are confident that the new configuration is working correctly.
Frequently asked questions
Does changing the WordPress site URL affect SEO?
It can, particularly if you change the domain or move pages to different addresses. Update internal links and canonical URLs where necessary, configure appropriate redirects, and ensure your sitemap reflects the new URLs. Changing only HTTP to HTTPS also requires checking that redirects and canonical URLs use HTTPS consistently.
Can I change the WordPress URL without losing content?
Yes. Changing the URL settings does not, by itself, delete your posts, pages or media. However, an incorrect configuration can make the site inaccessible, and a domain migration may require updating database references and other settings. Back up your website before proceeding.
Why are the WordPress Address and Site Address different?
They can differ when WordPress’s core files are installed in a subdirectory but the public website is served from another directory. For a standard installation in the domain root, the two addresses are usually identical.
Why are the URL fields locked in WordPress?
The fields may be controlled by WP_HOME or WP_SITEURL constants in wp-config.php. Other installation-specific restrictions may also apply. Check the configuration before attempting to change the values through the database.
Should I change the GUID values when migrating to a new domain?
No. WordPress uses post GUIDs as persistent identifiers, including in feeds. Its migration guidance advises leaving the GUID column unchanged when performing URL search-and-replace operations.
Conclusion
The safest way to change a WordPress site URL is to back up the website, identify the correct WordPress Address and Site Address, and update the settings using the appropriate method for your installation.
If you are changing domains, also update old URL references safely, configure redirects and test the new website thoroughly. Keep a recoverable backup until the migration is complete and the important pages and functions work as expected.
- Compare backup and staging tools
- A simpler path for your next migration
- Less stress on update day