WordPress

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.

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

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'

with RELOCATE

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.

edge

Share
Published by
edge

Recent Posts

Disable Copilot on Windows 11 via Group Policy GPO

If using Copilot right from the Taskbar isn't your thing, you should disable it. Even…

8 months ago

Setting Default Fonts in Word, Excel, Outlook, and PowerPoint via Group Policy

In an environment where standardizing things does matter, setting default fonts in Microsoft Office apps…

9 months ago

Wake-On-LAN (WOL) with Windows and PowerShell

Wake-On-LAN is a networking standard that lets you wake up a computer from either a…

9 months ago

How To Remove Restrictions Set in A Password-Protected PDF File

First of all, this is not to bypass a PDF file that requires a password…

10 months ago

How To Move My Outlook Navigation Bar Back From Left Back To the Bottom

Microsoft has been lurking about the idea of placing the Outlook navigation bar to the…

2 years ago

Headset with Microphone Echoing My Own Voice on Windows, What To Do?

One colleague came up to me the other day asking me to take look at…

2 years ago