How to Change The Site URL in WordPress

In this article we will discuss how to change the site URL in WordPress. Sometimes you may need to change the URL of your WordPress site. Maybe you are changing domains, moving to a subdomain to main domain, updating from www to non-www, migrate from HTTP to HTTPS.

For example, it is a common practice to develop the new version of your site in a sub folder (like example: ) and when it is ready to move it into your root folder ( Whatever the reason may be, there are a few different methods you have when it comes to changing the URL.

There are two easy methods to change the site URL in WordPress manually.

Method 1: Edit wp-config.php

It is possible to set the site URL manually in the wp-config.php file. Add these two lines to your wp-config.php, where “” is the correct URL of your site.


Method 2: Edit functions.php

Simply add these below two code lines to the functions.php file of your theme.

update_option( 'siteurl', '' );
update_option( 'home', '' );

Use your own URL instead of

Then simply load your site from its new location ( – it should work just fine. Note that after you run your site once and you make sure it works you should remove those lines from your functions.php file.

Leave A Reply

Your email address will not be published.