Change WordPress URL in wp-config.php File

The most common way to change your WordPress URL is via your wp-config.php file. It is important to note that values in wp-config.php override the settings in method one. The wp-config.php file is typically located at the root of your WordPress site and can be accessed via cPanel File manager.

simply input the following code towards the top of the file, changing the values to reflect your domain.

define('WP_HOME','https://yourdomain.com');
define('WP_SITEURL','https://yourdomain.com');

Change WordPress URL in wp-config.php file

You can always remove the two lines if you prefer to edit these values from the WordPress dashboard.


Was this article helpful?

Related Articles