How to quickly change the wordpress site url editing wp-config.php

Last modified: June 17, 2020
You are here:
Estimated reading time: 1 min

WordPress is a free and open-source content management system(CMS) based on PHP and MySQL. WordPress keeps track of itself via WordPress address and site address settings. If you change the location of WordPress installation or migrate your WordPress website, you need to change the URL of your WordPress website. It is a common practice to develop the new version of your WordPress website in a subfolder and move it to the main directory when the website is developed. But your WordPress website will not work properly if you simply move all your files and database to another location. It is because WordPress relies on its URL settings to work properly.

 

WordPress Address and Site Address

WordPress address is where your WordPress core files reside. The WordPress admin pages along with other important parts such as /wp-content/, /wp-include/ lies here. It is where the brain codes of your WordPress website lie. WordPress site address is the URL typed in a browser to reach your WordPress website. It is the URL that your visitors use to visit your website. Both the addresses are same for a normal WordPress installation. These addresses vary when you have installed your WordPress in a directory other than your public home page(public_html). If you want your root directory free from WordPress directories and files, then install it on any other directory under the root directory.

Change WordPress address with wp-config.php file

 

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

1) Using your favorite editor, edit wp-config.php file.

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

define(‘WP_HOME’,’http://interserver.net’);
define(‘WP_SITEURL’,’http://interserver.net’);

Change interserver.net to your own domain name.

The changes should go under the MySQL settings.

Was this article helpful?
Dislike 0
Views: 19