How to Change Your WordPress URL (Site Address and WordPress Address)
To change your WordPress URL, go to Settings → General in your WordPress admin and update the “WordPress Address (URL)” and “Site Address (URL)” fields. If you are locked out of the admin because of a wrong URL, you can fix it by editing wp-config.php, updating the database directly through phpMyAdmin, or using WP-CLI. The method you use depends on whether you can still access your WordPress dashboard.
WordPress uses two URL settings that control how your site functions. The WordPress Address (URL) tells WordPress where its core files are located. The Site Address (URL) tells WordPress what URL visitors should use to reach your site. In most installations, these are identical. But they can differ if WordPress is installed in a subdirectory while the site is served from the root domain, or if you are in the process of changing domains.
Changing these URLs incorrectly can lock you out of your site entirely — the admin dashboard becomes inaccessible, and pages do not load. This guide covers how to change your URL safely and how to recover if something goes wrong.
When You Need to Change Your WordPress URL
Switching from HTTP to HTTPS. After installing an SSL certificate, you need to update both URLs from http://yourdomain.com to https://yourdomain.com. This is the most common reason for a URL change.
Changing domain names. Moving from olddomain.com to newdomain.com requires updating both URL settings plus all internal links and media URLs in your database. Our migration service handles this comprehensively.
Adding or removing “www”. Standardising between www.yourdomain.com and yourdomain.com — both should resolve to the same version, and WordPress needs to know which one is canonical.
Moving WordPress from a subdirectory to the root. If WordPress is installed in yourdomain.com/wordpress/ but you want it accessible at yourdomain.com, both URL settings need updating. Read our guide on moving WordPress from a subdirectory to root for the complete process.
Moving to a temporary URL during development. Setting up a staging or development site at a different domain or subdomain requires URL changes.
Method 1: Change URL From WordPress Admin (Easiest)
If you can access your WordPress admin dashboard, this is the simplest method.
Go to Settings → General. You will see two fields: “WordPress Address (URL)” and “Site Address (URL).” Update both fields to your new URL. Ensure you include the correct protocol — https:// not http:// if you have SSL. Do not include a trailing slash. Click “Save Changes.”
Critical warning: If you enter the wrong URL here, you will immediately lose access to your WordPress admin. The admin will try to load from the new URL, and if that URL does not resolve correctly, you are locked out. Double-check the URL before saving. If you do get locked out, use Method 2 or Method 3 below to fix it.
After changing the URL, clear your browser cache and verify that your site loads correctly at the new URL. Check a few pages to confirm everything works.
Method 2: Change URL via wp-config.php (When Locked Out)
If you changed the URL incorrectly through the admin and are now locked out, you can override the URL settings by editing wp-config.php. This method takes precedence over the database settings.
Connect to your site via FTP, SFTP, or your hosting file manager. Open wp-config.php in the WordPress root directory. Add these two lines above the line that says “That’s all, stop editing!”:
define('WP_HOME', 'https://yourcorrectdomain.com');
define('WP_SITEURL', 'https://yourcorrectdomain.com');
Replace https://yourcorrectdomain.com with your actual correct URL. Save the file.
These constants override the database values for WordPress Address and Site Address. Your site should now load at the correct URL. Log in to your WordPress admin — the Settings → General fields will be greyed out because the wp-config.php constants are taking precedence.
Making it permanent: If the wp-config.php constants reflect the correct permanent URL, you can leave them in place — they will always override the database values. Alternatively, update the database values (through Settings → General, which you can now access), then remove the wp-config.php constants.
Method 3: Change URL via Database (phpMyAdmin)
If you prefer to change the URL directly in the database — or if the wp-config.php method does not work for your situation — you can edit the values in phpMyAdmin.
Log in to your hosting control panel and open phpMyAdmin. Select your WordPress database from the left sidebar. Click on the wp_options table (the prefix may differ — it might be xyz_options depending on your installation). Look for two rows: siteurl (option_id is usually 1) which corresponds to the WordPress Address, and home (option_id is usually 2) which corresponds to the Site Address. Click “Edit” on each row and update the option_value to your correct URL. Click “Go” to save each change.
Important: Only change the option_value column. Do not change the option_name, option_id, or autoload values. And ensure you use the correct URL format — include https:// or http:// and do not include a trailing slash.
Method 4: Change URL via WP-CLI
If you have SSH access to your server and WP-CLI installed, you can change the URL with two commands:
wp option update home 'https://yourcorrectdomain.com'
wp option update siteurl 'https://yourcorrectdomain.com'
This is the fastest method if you are comfortable with the command line. It updates the database values directly without needing phpMyAdmin or the WordPress admin.
For a domain change where you need to update all internal links and media URLs (not just the site URL settings), WP-CLI’s search-replace command is the proper tool:
wp search-replace 'https://olddomain.com' 'https://newdomain.com' --all-tables
This finds every instance of the old URL in your database — in post content, media URLs, widget settings, plugin configurations, serialised options — and replaces them with the new URL. The --all-tables flag ensures even custom tables created by plugins are included. Read our guide on using WP-CLI for more command-line WordPress management.
After Changing Your URL: Essential Follow-Up Steps
Update Internal Links
If you changed your domain (not just HTTP to HTTPS), your post content, menu links, and widget content still contain the old URL. Use the Better Search Replace plugin or WP-CLI’s search-replace command to update all instances of the old URL to the new one throughout your database.
Set Up Redirects
If you changed domains, set up 301 redirects from every page on the old domain to its equivalent on the new domain. This preserves your SEO and ensures visitors (and Google) following old links reach the correct new pages. Read our guide on WordPress redirections.
Update Google Search Console
If you changed domains, submit a Change of Address in Google Search Console. This tells Google that your site has moved and to transfer ranking signals to the new domain. Also submit an updated sitemap for the new domain.
Fix Mixed Content (HTTP to HTTPS)
If you switched from HTTP to HTTPS, you may have mixed content warnings — resources (images, scripts, stylesheets) still loading over HTTP on your HTTPS pages. Use Better Search Replace to change all http://yourdomain.com references in your database to https://yourdomain.com.
Clear All Caches
Clear your WordPress caching plugin’s cache, your CDN cache (if applicable), and your browser cache. Old cached pages may still contain the old URL.
Frequently Asked Questions
I changed the URL and now I am locked out. How do I get back in?
Use Method 2 (wp-config.php) or Method 3 (phpMyAdmin) to set the URL back to the correct value. Neither method requires WordPress admin access. If you are not sure what the correct URL should be, check your hosting control panel for your domain’s DNS settings — the URL should match the domain your hosting is configured to serve.
What is the difference between WordPress Address and Site Address?
WordPress Address (siteurl) tells WordPress where its core files live on the server. Site Address (home) tells WordPress what URL to use when generating links and loading the site. In most installations, they are identical. They differ when WordPress is installed in a subdirectory (e.g., /wp/) but the site is served from the root domain — in that case, siteurl would be yourdomain.com/wp and home would be yourdomain.com.
Can I change just one of the two URLs?
Yes, but only if you understand the specific configuration you are creating. For a standard installation where WordPress core files are at the same location as your site root, both URLs should always be the same. The only common scenario where they differ is a subdirectory installation — and even then, the process requires additional steps (moving index.php to the root, updating .htaccess). See our subdirectory to root guide.
Do I need to change the URL when moving to a new host?
Only if your domain name is changing. If you are keeping the same domain and just switching hosting providers, the WordPress URL settings stay the same — you only update DNS records to point to the new host. Our migration service handles all of this automatically.
Need Expert Help? Let WP Ministry Handle It
URL changes — especially domain changes — involve multiple interconnected steps. A missed redirect, an un-updated database reference, or a forgotten Search Console notification can damage your SEO and break functionality. If you want this handled properly without risk, our team can help.
Call (901) 249-0909 for immediate assistance, or explore our WordPress migration service for comprehensive domain and host changes with full SEO preservation.
Related Articles
How to Fix the WordPress “Mixed Content” Warning (HTTP to HTTPS)
How to Set Up WordPress Redirections Properly (301, 302, 307)