Monday 11 November 2013

How to change a Wordpress website site URL

Sometimes you may need to change your WordPress site's URL.

For example, it is a common practice, develop new versions of the site, sub-folder when it is ready to move it to the root directory.

WordPress, however, depends on its URL is set to work properly.

This means that if you are just your files and database will not work correctly.

Located in the URL of the application database settings. Fortunately, the use by the WordPress developers called "update_option" provide a good function to avoid modifying the database directly.


Just add these lines to your theme functions.php file:

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

Then just load your site a new location - it should work just fine.

Please note that when you run your site once, and you want to make sure it works, you should start your functions.php file, delete the rows. Settings are already stored in the database and should not be modified each time you load your site.  

No comments:

Post a Comment