Wednesday 5 March 2014

Replace old domain name or URL with new URL in WordPress

To replace the old domain name or the URL with the new URL in the wordpress blog site, refer the following steps :

Login to the cPanel >> go to phpMyAdmin >> Select the database you want to modify >> click on the SQL

Then type the following query to execute :
To update WordPress options with the new blog location, use the following SQL command:
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

After that to fix URLs of the WordPress posts and pages stored in database wp_posts table as guid field use the following SQL command:
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

Finally Use the following SQL commands to fix all internal links:

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

No comments:

Post a Comment

ERR_CONTENT_DECODING_FAILED

If you are getting the error as ERR_CONTENT_DECODING_FAILED while accessing the domain then add the below extension in php.ini  ++++++++...