WordPress tutorial: How to change WordPress URL – How to change the WordPress address (URL) and WordPress Site address (URL). There are two URL fields of a wordPress website – “WordPress address (URL)” and “Site address (URL)”. These are also known as the “Home” and “Site URL” settings respectively.
WordPress URLs
To summarize, there are two types of WordPress URLs:
- The “Site address (URL) – Site URL” setting is the address where the WordPress core files are located.
- The “WordPress address (URL) – Home” setting is the address people type in their browser to open the WordPress website.
These settings control where WordPress website is located. They are responsible to the display of the URL in the admin section of the WordPress website page as well as the front end. These are used throughout the WordPress code.
Changing the WordPress Site URL
First Method
You can easily change the Site URL manually via editing the wp-config.php file. To set the site URL manually in the wp-config.php file, open the file and follow the stpes given below.
Add the following two lines to the wp-config.php, where “example.com” is the correct location of the WordPress website.
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
IMPORTANT: These steps are for strictly for a single WordPress website. If you are using WordPress MultiSite, you will need to manually edit the database to change the URL.
Second Method
The WordPress Site URL settings are located in the application database. If you want to avoid the danger of direct database modifications, you can use “update_option” function (provided by the WordPress developers).
To use this function, simply add the following code to the functions.php file of the current theme of the WordPress website:
update_option('siteurl','http://www.new-site-address.com');
update_option('home','http://www.new-site-address.com');
Once added, simply close the website and reload it from its new location.
You can also change the WordPress Site URL by editing th functions.php via FTP.