How to Change the Site URL and Home URL Settings in WordPress? Print

  • 37

WordPress offers two configurable URLs, namely the WordPress address and Site address, to load the content correctly. WordPress highly relies on these URL settings as each has its importance. However, WordPress beginners often find these terms confusing about what each one does or why we need them. 

So, in this article, we will provide you with a complete understanding of the WordPress address and Site address.


Site Address – Site URL

The Site Address or Site URL is the address you want your website visitors to type in a web browser to reach your website. For example, if your website is mydomain.com, then http:// mydomain.com is your site address.


WordPress Address – WordPress URL

The WordPress address is the location of the core WordPress files. In most cases, the Site URL and WordPress URL (HOMEURL) will be the same unless you install WordPress in a separate folder.

For example, your WordPress URL and Site URL will be the same if you install WordPress into the document root (/home/cPanel_user/public_html/). To access the WordPress dashboard, you will have to visit http://mydomain.com/wp-admin.

If you install WordPress in some subdirectory, such as 'WordPress,' your Site URL would be http://mydomain.com/WordPress.
To access the admin dashboard, you will have to visit http://mydomain.com/WordPress/wp-admin.


Why do you need to change these URLs?

You need to change these URLs when you move a WordPress website to a new location or you want to shift your website to a brand-new domain. These options are most useful when you develop the new version of your site in some subfolder, and you wish to move to the root directory when it is ready.

.



How do I change these URLs?

You can change these URLs using any one of these two options –


  • Using WordPress admin 
  • Using wp-config.php file


Using WordPress admin

  1. At the WordPress dashboard, you are given an option to modify these URL values. 
  2. Once logged into the WordPress dashboard, navigate to Settings >> General page.
  3. Enter the new  WordPress Address or Site Address value and click Save Changes.


 Wordpress Admin

Using wp-config.php file


The easiest way to modify WordPress URLs is via the wp-config.php file –

  1. Edit your wp-config.php file.

  2. Insert the following two lines and define your WP_HOME and WP_SITEURL in the wp-config.php file. 

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

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


Please note that adding the Site URL in the wp-config.php file will override the WordPress admin settings.


Change WordPress Address from the Database


Sometimes your last changes may lock you out from WordPress dashboard access. In such a case, you may directly modify WordPress URL settings from the WordPress database using the phpMyAdmin tool. 

The following instructions will guide you on how to change the WordPress website URL using phpMyAdmin in cPanel.

  1. Before making any changes to the WordPress database, first backup the WordPress database.

  2. Login to cPanel and navigate to the phpMyAdmin menu.

 


Login to phpmyadmin

3. Select the database which is being used for your WordPress website.


Select wp-options table

4. Click on wp_options table and find option_name - siteurl.

5. Click the checkbox, then click Edit.


  1. Siteurl and Home

    6. Change the option_value to the correct URL.

  2. 7. Scroll to the bottom and click Go to save the change.

    Change Siteurl

    1. 8. Search option_name - home and repeat the process.

    → Are you looking to change the WordPress URL? 

    Refer to the Change WordPress URL for more details.

Was this answer helpful?

« Back

chat