Changing SITE URL and HOME settings in WordPress

Contents:

  • Changing SITE URL and HOME settings directly in the WordPress admin dashboard

  • Changing SITE URL and HOME settings in wp-config.php

  • Changing SITE URL and HOME directly in the database via phpMyAdmin

When you migrate your WordPress installation to a different location or when you need the same site working with another domain name, changing SITE URL and HOME is a necessary step. These settings not only control the location of WordPress installation, but they are also responsible for the display of the URL in the admin section of your page, as well as the front end, and are used throughout the WordPress code.

If you need full instructions for WordPress migration, please check this article.

There are a few ways to change WordPress settings:

Changing SITE URL and HOME settings directly in the WordPress admin dashboard

There are two fields named “WordPress Address (URL)” and “Site Address (URL)” on n the Settings->General screen.

To change settings login to WordPress dashboard as an administrator → Go to the Administration → Settings → General panel. Set the new location of WordPress core files in text boxes such as WordPress Address (URL) & Site Address (URL) → Save changes.

General wordpress settings

The “Site Address (URL)” is the address your visitors will type in the address bar of their browsers to access your WordPress site.

The “WordPress Address (URL)” indicates the location of WordPress core files.

Note: Both settings start from the HTTP:// part and should not have a slash “/” at the end.

Changing SITE URL and HOME settings in wp-config.php

This is another easy method to change WordPress settings. However, please note that this is not the best fix because in that case you won’t be able to edit SITE URL and HOME values on the General settings page anymore when using this method.

To change WordPress settings, please add these two lines to your wp-config.Php, where “domain.com” is the correct location of your site.

define(‘WP_HOME’,'http://domain.com’);
define(‘WP_SITEURL’,'http://domain.com’);

wordpress wp-config file

You can also use the IP of your domain instead of the name of your domain. For example,

define(‘WP_HOME’,'http://12.34.56.78′);
define(‘WP_SITEURL’,'http://12.34.56.78′);

If your WordPress installation is located in some sub folder, you need to add next two lines to the wp-config.php file where the “domain.com” is your domain name and “some folder” is a name of the folder where WordPress is installed:

define(‘WP_HOME’,'http://domain.com/somefolder’);
define(‘WP_SITEURL’,’http://domain.com/somefolder‘);

domain subfolder wo-config file

Changing SITE URL and HOME directly in the database via phpMyAdmin

At first, it is necessary to create a backup of the database your WordPress site is using just to be able to revert next changes back in case something goes wrong.

To change WordPress Address (URL) & Site Address (URL) in phpMyAdmin:

wordpress - database change 01

  • Click the database you need to manage from the left side of the screen under the phpMyAdmin logo. 

 

wordpress - database change 02

  • Then select your wp_options table by clicking on it. Note that the wp_ prefix may differ depending on your install settings.

wordpress - database change 03

  • Click Edit beside the site URL entry & change the option_value to the new location of your WordPress site.

wordpress - database change 04

  • Enter in your new address in the option_value field, then click on Go.

wordpress - database change 05

  • Go the second page of WordPress options by selecting the “2“ page on the drop-down list at the top or the end of the page.

wordpress - database change 06

  • Click Edit beside the home entry & change the option_value to the new location of your WordPress site.

wordpress - database change 07

That’s it! Now your site should be pointed to its new location.

 

Was this article helpful?

Yes (7)
No (0)

We're sorry you didn't find this article very helpful. Please help us improve it by leaving your feedback below.

Error