Changing The Site URL of WordPress

Changing The Site URL of WordPress

wordpress logoI recently moved my blog from co.cc domain to .com domain. The server was same, only domain name was changed , so I moved all my WordPress files to a new folder. Since the settings in database was still of old domain , the page was not loading from new domain. There are 2 methods of doing this, 1. editing wp-config.php and 2. editing database .

Editing wp-config file

Add this line in your wp-config.php and save it,


update_option('siteurl','http://example.com/blog');
update_option('home','http://example.com/blog');
define('RELOCATE',true);

Editing Database

This may cause damage if not done properly, so I suggest you to back up your database first. Now, login to phpmyadmin and select your WordPress database. Then go to tab “Query” . At the bottom there is a text are with name “SQL query on database ur_databasename” .
Below there put the code below
UPDATE wp_posts SET guid = REPLACE (
guid,
'http://oldsiteurl.com',
'http://newsiteurl.com');

And press submit query , code above will automatically replace all old url with new url supplied on selected table.

Pritush

Nepallica was started by Pritush and regularly updates this blog, beside Nepallica he also contributes to Nepalunderground.com. Connect with on Google+

Leave a Reply

avatar
  Subscribe  
Notify of
Close Menu