How to change WordPress URL
You might be changing to a new domain name, updating your site to use HTTPS, migrating from local server to live site, or transferring to a subdomain, you will need to know how to change your WordPress site URL.
The WordPress address and site address are extremely important fields because they reference the address of your website on the internet and the location of your website files.
We will share four different ways to easily change your WordPress site URLs step by step.
How to change WordPress URL via WordPress Dashboard
This method is the easiest. If you can already access the WordPress admin area, then we recommend using this method. Simply login to your WordPress website and go to “Settings > General” page. From here you can change WordPress site URLs under the “WordPress Address” and “Site Address” options. Don’t forget to click on the “Save Changes” button to store your settings. You can now visit your website to make sure that everything is working OK.
How to change WordPress URL via wp-config.php
The second most easier way to change your WordPress URL is in your wp-config.php file. The wp-config.php file is typically located in the root directory of your WordPress site and can be accessed via FTP, SSH, or WP-CLI.
In your wp-config.php file, add these two lines somewhere above the line that tells you to stop editing:
define( 'WP_HOME', 'https://your_new_url.com' ); define( 'WP_SITEURL', 'https://your_new_url.com' );
Save your wp-config.php file and close it. If you want access to those settings in your dashboard again, all you need to do is remove them from your wp-config.php file.
How to change WordPress URL via Database
This is done with phpMyAdmin. The phpMyAdmin tool is found in your host’s Plesk or cPanel. Go to phpMyAdmin and select your site’s database from the list on the left side. Go down on the page until you see the “wp_options” table. Some sites may have different names for this, but most of the time it ends in “_options”.
This file lets you enter a new “siteurl” and “home”. All you have to do is select those values and type in the new domains. Click “Go” to save them. Remember, this modification means that your site is now only accessible through the new URL.
How to change WordPress URL via wp-cli
Another option is to use the WordPress Command Line Interface (WP-CLI) to access your site and edit the URL. You’ll need SSH access to your site (WP-CLI must be installed) and you’ll need to be familiar with the process for accessing your site using WP-CLI.
The commands to edit your URL are as follows:
wp option update home 'https://your_new_url.com' wp option update siteurl 'https://your_new_url.com'
You can change the settings in the WordPress admin dashboard, edit the database, or edit them in your wp-config.php file, or use WP-CLI. Try either one or two steps on how to change WordPress URL, make sure everything works and you are good to go.