How I move a WordPress blog to a new host

Aaron Brazell described how he moves his WordPress blog to a new host and it’s very familiar since I’ve done something similar a few times over the last few months.

I’ve figured out a few things from those moves which you might find useful if you get sick and tired of your hosting:

  1. If you’re self hosted and have a domain name, set the “time to live” (TTL) to as small as possible, say 15 minutes. You should do this about 24 hours previously. Doing this will mean that visitors to your bog will start seeing your new host sooner!
  2. Just after you dump your database to a file for export close all your posts to comments. I do this with the SQL, UPDATE wp_posts SET comment_status='closed'. Now quickly transfer your db over and get your site up and running in the usual manner. Your old site will still get traffic for a while yet. Googlebot will still visit too, but nobody will leave comments there so you don’t have to worry about synchronising your comments table. You could do the same with ping_status too if you get a lot of pings.
  3. For extra brownie points add a small message in the comment area informing the visitor that, “Comments are disabled. This site has moved to new hosting. Please check back later to leave a comment.”
  4. If you fiddle with your hosts file make sure there isn’t an entry for your domain pointing at the old site. That happened to me on my Macbook and even after updating /etc/hosts it still didn’t work right. I had to reboot the laptop!
  5. Say “Thank You” to anyone who helps, especially support staff!

Good luck moving, it’s not as hard or as daunting as it might be. ssh, scp/rsync, mysql/mysqldump and tar/gzip are your friends when moving!

Further Reading:

PS. Thanks to Linode for hosting, Blacknight and Michele for DNS, and you for WordPress.


46 Comments

Grannymar (10 comments.) on April 9, 2007 at 10:02 am.

Donncha that is all way above my head!

Tell me how is the Lady-in-Waiting?

Reply

Donncha (1707 comments.) on April 9, 2007 at 10:30 am.

Grannymar – just get George to move your blog if you ever want to, that’s what son-in-laws are for! :)

We realised yesterday that it was possibly the last or second last Sunday where we could sit at the breakfast table and read the Sunday Times in peace and quiet, for a long time! Jacinta is well, she gets tired easily but the sun over the weekend was great! She’s glad she wasn’t pregnant over a hot summer though. Not that fond of high temperatures.

Here’s hoping the next trip to the hospital will be less stressful!

Reply

jez (6 comments.) on April 9, 2007 at 10:38 am.

good write-up, I should have considered that before moving over to dreamhost :)
thanks,
jez

Reply

Aaron Brazell (3 comments.) on April 9, 2007 at 12:23 pm.

Thanks for the link, Donncha!

As for this:

If you fiddle with your hosts file make sure there isn’t an entry for your domain pointing at the old site. That happened to me on my Macbook and even after updating /etc/hosts it still didn’t work right. I had to reboot the laptop!

1. You were probably using Firefox which is notorious for keeping cache stuff. Do yourself a favor when its important to get the latest and greatest and use Safari. :)

2. Run lookupd -flushcache everytime you save /etc/hosts…

:)

Reply

Donncha (1707 comments.) on April 9, 2007 at 12:34 pm.

You’re welcome Aaron! Even worse than Firefox, I’m using Flock. It held on to the old IP address for at least 24 hours.

I even wondered why my post from Flickr hadn’t shown on inphotos.org yet. It had been posted, but on the new host :)

Reply

DG (1 comments.) on April 9, 2007 at 2:24 pm.

Hi Donncha,

DO you’ve any solution for importing WordPress MU SQL table into WordPress 2.1.3?

Advice.

DG…

Reply

Rudd-O (1 comments.) on April 9, 2007 at 2:44 pm.

I just wrote a “succint” guide that covers all the WP-to-WP migration bases. Hope you enjoy it.

Reply

Aaron Brazell (3 comments.) on April 9, 2007 at 2:48 pm.

Oy @ Flock. ;)

Reply

Donncha (1707 comments.) on April 9, 2007 at 3:27 pm.

DG – Just like on WordPress.com you can use the export tool and then import it back into your new WordPress install.
If you don’t want to do that then simply dumping the tables to a file and copying the posts, comments and related tables into your new wordpress install should work ok. Just don’t forget to change user IDs in the posts table!

Reply

Mosey on April 9, 2007 at 3:58 pm.

This is going to be a really newbie question – how do you tell if your site is getting lots of pings? :)

Thanks for the guide though!

Reply

Donncha (1707 comments.) on April 9, 2007 at 4:11 pm.

Mosey – See the pingbacks below your comment on this page? Those are pingbacks. They happen whenever a blog that supports pings or trackbacks (like WordPress, or Typepad and many other blog engines, *not* Blogger or most photoblog software AFAIR) mentions another post. The blog sends a “ping” to tell the other post, “I mentioned you! Add this to your comments please!”

It’s a great way of keeping a conversation going, especially across separate websites. Check the two pings below for posts about moving your blog!

Reply

LiewCF (2 comments.) on April 9, 2007 at 5:18 pm.

the MySQL query to close comment is useful. Thanks.

Reply

Mosey on April 9, 2007 at 7:50 pm.

Hi Donncha, Thanks for the detailed (et. plain English :D ) explanation – I found it very helpful! Alas my site doesnt seem to have many pings so hopefully more people will link soon.

Reply

fmf (2 comments.) on April 10, 2007 at 3:24 pm.

Thanks for this howto, I’m planning to move in a few days.
Just a question: that MySQL query closes all comments for old post, but what about to reopen them after migration?
And more important: what about if I have some old posts with pen comments and other with closed comments and I’d like to maintain the same configuration after migration?
TIA.

Reply

Donncha (1707 comments.) on April 10, 2007 at 3:32 pm.

fmf – you’re welcome! You should dump your database to disk before closing off all the comments. I presume your site isn’t that busy that you’d get a comment or two in the few seconds it would take to switch apps to phpmyadmin :)

This also avoids the problem of remembering which posts were open before!

Reply

fmf (2 comments.) on April 11, 2007 at 2:18 pm.

“I presume your site isn’t that busy that you’d get a comment or two in the few seconds it would take to switch apps to phpmyadmin”

Of course that wasn’t the issue: I only have 456 posts and 499 comments, little more than one comment per post.
I just miss the ‘dump your database to disk’ meaning…
My fault.
Thanks, maybe in the near future if I’ll change my hosting and I’ll translate your howto for italian speakers in my blog I’ll give you credits.

Reply

Cormac Moylan (4 comments.) on April 21, 2007 at 10:34 pm.

Donncha, nice post. I posted on this very topic a while back myself but I took a different spin on it. Obviously yours is a bit more technical in parts. I took the softy soft approach.
http://cormacmoylan.com/blog/software/how-to-transfer-your-wordpress-blog-from-one-host-to-another-host.eire

Reply

Richard (1 comments.) on May 3, 2007 at 4:00 pm.

Hey Donncha,

Great post – I only wish I found this sooner :-)

I set up my own self hosted blog but started from scratch as I didn’t know how to transfer the old one and get it to work.

I’ll definitely use this if I ever have to transfer them in the future.

Thanks again!

Rich

Reply

kevstelo (1 comments.) on June 11, 2007 at 8:04 am.

I think I’ve read something simillar a few days ago. I don’t remember where, might have been on digg.com or slashdot.

Reply

Wordpress on December 27, 2007 at 11:20 am.

Before moving to new host you should read the feedback of existing users. If you plan on having a lot of hits you should consider hosting provider with load balancing and redundancy, not just a single-host based solution.

Reply

My Shopping Heaven on January 18, 2008 at 3:21 pm.

Just a short note to say thank you for the information. I recently faced this issue on one of my older sites and moving things around was certainly made easier by using the info provided.

Reply

Sherif Elsisi (2 comments.) on January 22, 2008 at 2:00 am.

Hi
Why wouldn’t you just take a home directory backup from your cpanel backup area. This will create a .tar.gz file that includes all your files, email, database entries..
ftp the file to your new account at the new host and ask support to install it.
I do this all the time and it works the best for wordpress and other non wordpress sites as well.
The only catch here is make sure your user id in the new site is the same as the old userid ( the one stored in the backup )
Please, let me know if you have any questions.
Sherif

Reply

Billo (2 comments.) on January 28, 2008 at 8:26 am.

Hm, I’m planning to move about 20 blogs to another host. Do you think it is possible to automize the process? Are there any tools for that?

Reply

Terry (1 comments.) on January 28, 2008 at 12:19 pm.

Some interesting comments there. It all sounds very technical, I can manage to create SQL databases, etc, but I have never moved one. I have bookmarked this page, thank you.

Reply

devon waring (1 comments.) on January 29, 2008 at 3:26 am.

or if it could be possible for the blogger to do a 310 redirect to their new domain blog from the older wordpress site maybe thats then less work to redue some things or lose some posts.

Reply

BOA Method (1 comments.) on February 14, 2008 at 2:51 am.

Hello there,

The best thing that you should is use your php admin and then to backup all you site content use the feature export and then you can an option somewhere just choose complete insert and at bottom part you can choose a compression to use it up to you on what compression that you are going to use and go click after that it ask you where to save your backup well choose a safe place where you can put your backup. and lastly bak up all your wordpress file by using your ftp account and download all your file to your computer. after finish that thing you are now ready to transfer to a new host for your blog. Again use your php admin of your new host and import your backup database to new host and click go after that your database is ready. and then follow with your files by using the ftp account of your new host upload all your files to your new host and then run as normal.

Revero
Make Money With Blogs

Reply

James C. (1 comments.) on February 26, 2008 at 7:46 pm.

When you move your blog to a new host should you worry about old content not being able to be retrieved? Should 301 redirects be configured so if any content that does have trouble being found you can direct the traffic back to the proper content?

Reply

toys on April 1, 2008 at 2:27 pm.

Great resource, thanks. I think I will have to start looking at a new host very soon, and the wonderful resources out there (such as yours) should certainly mean that things will go smoothly. The further reading you’ve provided seems excellent too, so thank you. I found that changing the TTL settings was a very interesting point; I will definitely be employing that one and seeing the benefits I’m sure.

Reply

DG (1 comments.) on July 30, 2008 at 12:26 pm.

I’ve recently moved my site to Media Temple, and put up two article explaining the move.

Read here Part 1 and Part 2.

Reply

Jeremy on October 27, 2008 at 4:26 am.

Moving from one host to another is always fun, not really but in a manner. You do learn about the process and after you do it a few times it becomes like second nature.

It can be much easier if you choose a new host that uses the same type of hosting control panel. And if you have cpanel you can make the change super fast and easy. Most cpanel hosts will even do it for you if both the old and new has cpanel.

Reply

Patrick Gallagher (1 comments.) on January 29, 2009 at 6:23 am.

To flush your DNS cache:

Mac 10.4: lookupd -flushcache
Mac 10.5: dscacheutil -flushcache

Windows: ipconfig /flushdns

Reply

A1QA (1 comments.) on April 25, 2009 at 10:17 am.

There’s a wordpress plugin that automatically makes backup of your database regularly and send it to a mail box. You can set up the mail box you’d like and the period of time between backups. Helps when moving.

Reply

John on May 12, 2009 at 8:36 am.

Why wouldn’t you just take a home directory backup from your cpanel backup area. This will create a .tar.gz file that includes all your files, email, database entries..
ftp the file to your new account at the new host and ask support to install it.
I do this all the time and it works the best for wordpress and other non wordpress sites as well.

Reply

Storm10 (1 comments.) on January 24, 2010 at 10:23 pm.

It’s very easy really, and there is alot of good people and good posts with the right info, The trouble is my FTP (CoffeeCup Direct) is playing up and missing files and corrupting images that it driving me MAD.

Reply

Pingback: Moving WordPress

Leave Your Comment

Your email will not be published or shared. Required fields are marked *

*

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


Holy Shmoly! is Stephen Fry proof thanks to caching by WP Super Cache