Wordpress blog software saves so much domain related data to database. For example it saves blogs that have pinged your posts (as you consider you can ping your posts also) , your blog url, a lot of permalinks, guids, etc.

So, if you move your blog to another domain you must update all of those. Without updating them most of your links will fail (=gives 404)

I searched Wordpress database to those kind of data. After understanding the database i wrote five mySQL queries to solve this sitiuation.

Here is the five query you must execute at the new server (by phpmyadmin or shell) :

( FROM_URL is the FROM blog, TO_URL is the TO blog )

UPDATE
  wp_comments
SET
  comment_author_url = REPLACE(comment_author_url,'FROM_URL','TO_URL');

Simply moving a blog from myblogs.com to myotherblogs.com you need to write the query like this :

UPDATE
  wp_comments
SET
  comment_author_url = REPLACE(comment_author_url,'myblogs.com','myotherblogs.com');

Keep executing below queries by replacing FROM_URL and TO_URL according to the sample above.

UPDATE `wp_options`
SET `option_value` = 'http://TO_URL/' WHERE `option_id` =1 AND `blog_id` =0 LIMIT 1 ;

UPDATE `wp_options`
SET `option_value` = 'http://TO_URL/' WHERE `option_id` =46 AND `blog_id` =0 LIMIT 1 ;

UPDATE wp_posts
SET post_content = REPLACE(post_content,'FROM_URL','TO_URL');

UPDATE wp_posts
SET guid = REPLACE(guid,'FROM_URL','TO_URL');

I hope this helps.

Tags: ,
Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>