How to Move a WordPress Website Using MYSQL and phpMyAdmin

Taken from here: http://www.designshifts.com/how-to-move-a-wordpress-website-using-mysql-and-phpmyadmin/

You will need access to your phpMyAdmin or login to the DB server and run MySQL client as root. Use the following SQL command to update the new location of your WordPress website URL:

 UPDATE wp_options SET option_value = replace(option_value, 'http://www.example.com', 'http://www.new-example.com') WHERE option_name = 'home' OR option_name = 'siteurl';

After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guide field. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:

 UPDATE wp_posts SET guid = replace(guid, 'http://www.example.com', 'http://www.new-example.com');

If you have created reference backlinks within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. Use the following SQL commands to fix all the internal links:

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

Revisions

No comments yet.

Leave a Reply