At some stage you may need to change your website address for one reason or another. For example, you may have a test server with a temporary host name or ip address to set up the WordPress site with. When you have finished configuring the WordPress site on the test server, you want to update the WordPress address with a real domain so it can go online. You may installed WordPress on a subdomain at the first place, and want to replace it with your top level domain or main domain later. If you want to test WordPress site on your own computer before uploading it to a server, you can install WordPress on Windows computer with XAMPP or set up WordPress site on Mac with XAMPP. Confused by WordPress site URL or WordPress address settings? You’re not alone. WordPress has the settings to change its site address or domain name form its Dashboard >> Settings >> General. You can find two options from there, one is “WordPress Address (URL)” and the other one is “Site Address (URL)”.
Most of these settings are easy to understand for consumers. The WordPress URL settings can be really confusing.
WordPress Address (URL) VS Site Address (URL)
What’s WordPress Address (URL), what is Site Address (URL)? And what’s the difference between them? Which should I change if I want to change my Site URL for WordPress? Do not worry. Today, we will explain how you can change WordPress domain or URL in simple steps. It is not as difficult as you might think. We will introduce some ways to update WordPress URL, so you can choose the one you prefer.
The “Site Address (URL)” setting is the address you want people to type in their browser to reach your WordPress site or blog. It is the public WordPress address or URL, normally your main domain name. “WordPress Address (URL)” is the address where your WordPress core files reside, such as index.php, wp-login.php, wp-config.php, etc. This is the internal WordPress URL address for the webmaster or site admin themselves. Normally they are the same. So when you decide to change domain or URL for WordPress, you should change them at the same time.
How to change my Site URL for WordPress?
Many WordPress users may get confused, as when they updated both the WordPress Address (URL) and Site Address (URL), their WordPress sites no longer work properly. There are mainly 4 ways you can change your WordPress site address. They work and perform much the same function.
- Edit wp-config.php file
- Edit Database
- Edit functions.php file
- Use Plugins
No matter which method you choose. You should always create a backup of your WordPress site before you make the change. If it is a production site, you can refer to this guide to back up and download WordPress files and database.
Change WordPress URL Address or Domain by editing WordPress config file
wp-config.php is one of the most important WordPress configuration files. You can edit WordPress core info such as creating WordPress database configuration from there.This file can be found at your WordPress root directory, the same folder contains WP core files like like wp-admin, wp-content, wp-includes, etc. You can connect to your FTP server through FTP client, download a copy of this file to your computer, edit it locally, then publish it to live server through FTP client to overwrite the existing or old one. You can also edit the WordPress wp-config.php file online. If you are using a cPanel web hosting, you can find this file in cPanel >> File Manager, right click on wp-config.php, then choose Code Edit from the pop-up context menu.
Add these two lines to your wp-config.php, where “example.com” is the correct domain or URL of your own site.
This is the easiest way you can update WordPress domain or site address. However it is not necessarily the best fix because it just hardcodes the values into the site itself. After the change, you won’t be able to edit them on the General settings page anymore.
Best Way to Change WordPress Domain or URL Address
Probably modification the WordPress domain or site URL from its database is the best method to do that. Although it is not the easiest fix. Almost all good WordPress hosting services offer phpMyAdmin for customers to manage WordPress databases. You need to connect to your WordPress database using phpMyAdmin, then open its wp_options table to update WordPress URL or domain from there.
Note that you will need to update the WordPress site URL from both the siteurl and home entries in the database. You can find more details from previous linked article.
Other ways to WordPress domain or URL address
We won’t discuss the functions.php editing method to change WordPress URL or domain as it can be complicated. There are many variables depending on individual circumstances. Change WordPress URL by installing a plugin is not difficult. You can do a search for such plugins. We will not discuss further about it which likely requires another long article.
Upate Jun 2018: this article was originally published in Sep 2015 and has since been updated. some dated content was removed, screenshots and more specific instructions were added in this update.