Home    Articles

 

How to move wordpress from one domain to another or change site URL

 

wordpress_logo

It is a very common practice to build a wordpress website on a development subdomain and after that to move it on live domain.
That requires an update of the site url.

In order to do that you have to use update_option function from wordpress, into your theme.

Open functions.php file from your theme and add this code:

update_option('siteurl','http://www.new-domain.com');
update_option('home','http://www.new-domain.com');

This should work just fine.
After you did this and your website works as espected remove the code added earlyer.
The settings are saved in the database. You don’t need that code anymore.

Enjoy.

by