WordPress provides two configurable URLs – WordPress address and Home address. There is a lot of confusion when it comes to understanding what each one does, why we need it, and how we go about configuring these URLs. In this article, we aim to demystify these URLs and give you a complete understanding of how you can use them. But before we jump right ahead, let us remind you to take backups. So that if something goes wrong, you still have the blog posts you have written and can quickly restore them. But if you are not using a backup service, then check out this backup plugin guide to choosing the best WordPress backup plugin. That said, let’s take a look at how you can change HomeURL and SiteURL.
Home Address – HOMEURL
The Home Address is the URL you want your visitors to type in to get to your Homepage. It is also known as the Blog Address or the Site Address. For e.g., if your website is http://example.com, this also becomes your HOMEURL. This is the directory where WordPress’s main index.php file is installed. Both SITEURL and HOMEURL values are the same unless you install WordPress in a separate folder.
WordPress Address – SITEURL
The first of the addresses is the SITEURL, also known as WordPress address. This is the location of your core WordPress files.
E.g. Your HOMEURL is http://example.com. If you installed your WordPress into your document root, the SITEURL will be the same as your HOMEURL. To access the Admin dashboard, you will go to http://example.com/wp-admin. On the other hand, if you installed WordPress in its own directory called “WordPress”, then your SITEURL would be http://example.com/wordpress. To access the Admin dashboard, you will go to http://example.com/wordpress/wp-admin.
Why change the URL?
It is required to change the URL while moving your WordPress install to a new location. You could be moving your WordPress to a new domain, e.g. http://example.com/wordpress to http://example.com. Or you could be moving it to a completely different hosted domain, e.g. http://example.com to http://newexample.com.
WordPress relies on these URLs to access your WordPress files and load the content correctly to your website. Since you are moving the site to a different URL, you will also need to update your WordPress site’s settings, to reflect the URL changes.
How to change the URL?
There are multiple ways to change the SITEURL and HOMEURL:
1. Using WordPress Admin
You can modify the URL values from the WordPress Admin dashboard. Login as admin and navigate to Settings-> General page from the dashboard. Enter the new value for WordPress Address or Site Address and click Save Changes.
2. Using wp-config.php file
You can set the SITEURL and HOMEURL at the time of installation or even modify it later using the wp-config.php file.
Adding the SITEURL in the wp-config.php file overrides the WordPress Admin settings and makes this field read-only. However, the HOMEURL is still editable from the Admin dashboard.
It’s advisable that you take WordPress backups while changing the URL. So that, on occasion of a misfortune, you can always restore your site back to normal.