4 Ways to Change WordPress Home and Site URL Address Settings

WordPress has two settings used to keep track of the site, WordPress Address (WP_HOME) to tell how to reach the home page and Site Address (WP_SITEURL) used when the home page is set to be different from the installation directory. These are also the settings you need to change when you need to migrate your WordPress website or change the location of WordPress installation, or simply set up a duplicate site for test purpose.

If that’s the case, here are 4 ways to change WordPress Address and Site Address.

Through Admin Dashboard

1. Log into the admin dashboard.

2. Go to Settings > General

3. Change both WordPress Address and Site Address settings, click Save Changes button to save the changes.

This only works before the migration happened when you still have access through the old site URL.

With wp-config.php file

1. Open wp-config.php file.

2. Add the following two lines to the file, preferably near at the top of the file.


This works the best if you have access the site via FTP or SSH.

Update directly in the database

Since both settings are saved in the database, we can simply use phpMyAdmin tool or Update SQL command to update the setting directly against the wp_options table in WordPress database.

UPDATE wp_options SET option_value='http://example.com' WHERE option_name like 'home'
UPDATE wp_options SET option_value='http://example.com' WHERE option_name like 'siteurl'


If you’re having issues accessing your WordPress dashboard, you can have WordPress automatically try to figure out what the correct WordPress Address should be using the RELOCATE flag in your wp-config.php file.

1. Open wp-config.php file.

2. Add the following line to the file, preferably near at the top of the file.

define('RELOCATE', true);

3. Now log into the admin dashboard, go to Settings > General, you will notice that WordPress has automatically populated the WordPress Address (URL) field for you, with the path to your WordPress files.

I personally haven’t had an opportunity to test the last method but will update if it happens differently in the real world.

Leave a Reply

Your email address will not be published. Required fields are marked *