How to transfer your WordPress blog to a different domain name
June 29th, 2009 by Administrator    

transfer_blog

In this tutorial I will show you how to transfer your WordPress blog to a different host and on a different domain name. This might sound very simple as many may think, because there is a feature called Export and Import. This does a pretty good job transferring your entire WordPress database from one host to another. But what if your posts contain links to different posts within your site, this will not get updated and you will have to go to edit post by post. This is a real pain if you have huge database with hundreds, not to mention thousands of posts.

There is a solution for it, real simple to help you make a move to different domain name. Have you ever used a feature in MS Word called “Find and Replace”? If yes, then you will feel right at home. MySQL also has a similar way to do that. So let’s get started.

Step 1: Backup your database

If you have a small database, then PhpMyAdmin does a great job. Just go into PhpMyAdmin, select your database and click on export, and remember to check “save it as a file”.

If you have a large database, then MysqlDumper should be the way to go, it solves the PHP time out problem, and backs up you large database without a problem.

Step 2: Restore your database

Now that you have backed up your current database, you need to restore it onto your new host.

Download everything that’s on you current host, I mean the entire WordPress folder and upload it to your new host. Then restore your backed up database to your new host.

Step 3: Find and Replace

Now, the fun part begins. Go to your PhpMyAdmin, select your database, and click on SQL tab.

Now you need to run a few MySql queries to replace you old domain name with a new domain name. Do it one by one, and replace “your.old.domain” with your current domain and “your.new.domain” with your new domain you want to move to. I assume you WordPress tables prefix “wp_”, so you tables will look like wp_posts, wp_terms etc… If yours is not, then replace the “wp_” with your actual prefix.

UPDATE `wp_options` SET `option_value`= replace(`option_value`, ‘your.old.domain’, ‘your.new.domain’);

UPDATE `wp_postmeta` SET `meta_value`= replace(`meta_value`, ‘your.old.domain’, ‘your.new.domain’);

UPDATE `wp_comments` SET `comment_author_url`= replace(`comment_author_url`, ‘your.old.domain’, ‘your.new.domain’);

UPDATE `wp_posts` SET `post_content`= replace(`post_content`, ‘your.old.domain’, ‘your.new.domain’);

UPDATE `wp_posts` SET `post_exerpt`= replace(`post_exerpt`, ‘your.old.domain’, ‘your.new.domain’);

UPDATE `wp_posts` SET `guid`= replace(`guid`, ‘your.old.domain’, ‘your.new.domain’);

That’s it, and now you are good to go. If something goes wrong, just drop all of your tables and restore your database again.

You may want to search your database and see which other field still contains your old domain, and replace it.

Enjoy your new blog

You might also be interested in:

One Comment

  1. Buy synthroid Online
    http://synthroidshop.info/

Share your thought:

 
Web design by Phong Vu - All content posted on here is copyright by Phong Vu and its rightful owner.