Knowledge Base

How Can We Help?

WordPress – Changing Site URL and Home Settings

You are here:

In this tutorial, we will explore methods to modify WordPress Website URL and Home settings.

WordPress is a freely available and open-source content management system (CMS) built on PHP and MySQL. WordPress keeps track of itself using WordPress address and website address settings. If you change the location of your WordPress installation or migrate your WordPress site, you must update the URL of your WordPress site. It is a common practice to develop a new version of your WordPress site in a subfolder and then move it to the main directory once it’s fully developed. However, your WordPress site may not function correctly if you simply move all the files and database to a different location. This is because WordPress relies on its URL settings to function properly.

 

WordPress Address and Website Address

WordPress address is the location where your WordPress core files are stored. It includes the WordPress admin pages and other important components such as /wp-content/ and /wp-include/. It houses the core codes of your WordPress site. Website address is the URL entered in a browser to access your WordPress site. It is the URL that visitors use to visit your site. In a standard WordPress installation, both addresses are the same. However, these addresses differ if you have installed WordPress in a directory other than your public home page (public_html). If you want your root directory to be free from WordPress directories and files, you can install it in another directory below the root directory.

 

Modify WordPress Address in Admin Dashboard

Follow the steps below to update WordPress URL settings directly from the admin dashboard.

1) Log in to the WordPress admin dashboard.

2) Click on Settings >> General.

3) Enter your WordPress address and Website address.

4) Save the settings.

 

Modify WordPress Address with wp-config.php File

The default WordPress download package does not include the wp-config.php file. Instead, it contains wp-config-sample.php, which can be renamed to wp-config.php. This file is one of the core files of your WordPress site. It contains essential information about the database, WordPress address, and website URL settings. We can easily modify the WordPress URL through the wp-config.php file. This method is very useful if you have lost the ability to update them from your WordPress dashboard.

1) Edit the wp-config.php file using your favorite editor.

2) Add or modify the following lines and save the file.

—define(‘WP_HOME’,’https://webhostingpeople.net’);

—define(‘WP_SITEURL’,’https://webhostingpeople.net’);

Replace ‘https://webhostingpeople.net’ with your desired home address and website URL.

 

Modify WordPress Address with Relocate

If you are unable to access your WordPress admin dashboard, you can set the Relocate flag value to ‘true’ in the wp-config.php file. WordPress will then automatically determine the address to use based on the Relocate flag in the wp-config.php file.

1) Edit the wp-config.php file using your favorite editor.

2) Add the following line at the top of the file and save it.

—define(‘RELOCATE’, true);

3) Go to your http://example.com/wp-login.php in your browser, replacing http://example.com with the URL of your WordPress core files.

4) Log in to your WordPress dashboard, navigate to Settings >> General, and you should see that WordPress has already updated the ‘WordPress Address’ field.

 

Modify WordPress Address with functions.php

Each WordPress theme has a functions.php file. Using this file, we can update the WordPress address in the database. The direct modification of the database can be avoided by using the convenient ‘update_option’ function in the functions.php file.

1) Edit the functions.php file of your theme using your favorite editor.

2) Simply add the following lines and save the file.

—update_option(‘siteurl’,’http://www.new-site-address.com’);

—update_option(‘home’,’http://www.new-site-address.com’);

3) Load your site from its new location.

4) Once your site is running successfully, make sure to remove these lines from your functions.php file.

 

Modify WordPress Address with phpMyAdmin

Using phpMyAdmin, you can directly modify and update your WordPress address in the database. Follow the steps below to change the WordPress address.

1) Log in to phpMyAdmin.

2) Create a backup of your database before making any changes.

3) Select your WordPress database from the left panel.

4) Select the wp_options table.

5) Click on Edit next to either the site URL or home entries.

6) Enter your new WordPress address in the option_value field, then click Go.

 

If you need further assistance, please contact our support department.

 

 

Leave a Comment