Filed under: Developer, Internet, News, Windows, Linux, Blogging, Open Source, How-Tos, Mods
How to move a WordPress blog to a new host - DLS Recipe
- 1 Cup SQLyog (community edition) for exporting/importing (substitute: phpMyAdmin)
- 1 tsp. favorite FTP client (FileZilla, CuteFTP, WSFTP, CoffeeCup, iFTP)
- 1 whole fresh WordPress install, unzipped and ready to upload (get it here)
- 1 new host (Dreamhost is a good host)
- 30 mins to complete
- a dash of know-how (provided below)
WordPress (WP) is a piece of cake to install, but what if you need to move a WP install to another host, and you don't want to deal with your posts being all wonky and your links weird? You can try using the import function of WP, but I found it to be very hard to work 100% and give you exactly what you had before. Below is a way to get your exact blog back, almost exactly what you had at your old host. The only requirement is that your new hosting environment be somewhat similar (similar version of PHP and MySQL).
I suppose this would be a WP hack, and isn't the way WordPress says to do it, but in my experience, the WP way to import doesn't give you exactly identically what you had before (especially with templates). My way does. So you're ready to bake your first WP turnovers? Great. If you are sick of the old host you are now using, they don't have enough features, or you just plain got a better deal, here's how to move your WP install over to your new host.
Instructions:
Step 1: Use SQLyog or phpMyAdmin to backup your entire database. You should also go into WP and use the backup plug-in to make a copy of the site itself (preferably offline and somewhere safe).
Step 2: Next, use your favorite FTP client and connect to your old host, where your site currently lives. You'll need to copy your theme files, especially if you have made any custom hacks to them. If you don't copy them out, you'll not have them when you move your site. WP newbie tip: All theme files reside in www.yoursite.com/wp-content/themes/themename. That is the folder you want to copy. If you have multiple themes, copy all you want to end up on your new host. I would copy them to your hard-drive, then later we'll put them back. You can copy the whole themes folder if you want, no big deal.
Step 3: You must also copy any theme files you have that you want to keep. These live in www.yoursite.com/wp-content/plugins. Copy the whole plug-ins folder for later.
Step 4: FTP to your new server. If you don't already have the WP software in a zip file, you'll need to download it here. Once downloaded, unzip it, and upload it to your new server via FTP.
Step 5: Install WP like you are setting up a new site. Create a new database, or use an existing one but be sure that the tablenames (table prefix) is exactly what it was on your old host during WP install. Once the new WordPress install is complete, now comes the fun part.
Step 6: Export your WP tables (or the whole database) that pertains to your WP blog from your old host. I generally use SQLyog community edition and export just my WP tables into a "textfile.sql" file on my hard drive.
Step 7: Go to your new host's MySQL database (just created with the new WP install process), and delete the new tables from the database.
Step 8: Use SQLyog to import your textfile.sql file into the new host's MySQL database.
Step 9: Simply FTP all your theme files and plug-ins to your new host's folders. The locations are exactly the same as your previous host (besides the root directory).
Step 10: Lastly, be sure you manually go into your sidebar, header, and any other files in your template and change anything you may have hard-coded to the old host. Most WP users don't have that problem unless they have custom hacks in place.
Hot tip: If you use AJAX, lightbox, and some other special add-ons that are not plug-ins, it is a good idea to let them reside in your theme folder, so if you move that theme, all the cool effects and special hacks go with the theme you're using. Makes things easy.
As long as your old tablenames match the new tablenames (that were installed by WP), your new host will fool your blog into thinking that it still lives with all the same data at the old host, but everything will point to the new host. This is part of the underlying structure of WP, and this makes the blog act like nothing changed, though you are duplicating the files and moving the physical location somewhere else. This act of splicing your WP install into another one you have created give you the ability to get exactly what you had before. Beware that this may not work, I obviously don't have every configuration and system out there. All of the moves I have tried using this method have worked flawlessly, and I have highly hacked and modified installs, so it should work for almost everyone.

After spending the better part of an hour on 
Reader Comments (Page 1 of 1)
HandySolo said 12:36PM on 10-16-2006
And for your more "traditional" WordPress bloggers: http://codex.wordpress.org/Moving_WordPress
Reply
Mayank said 1:12PM on 10-16-2006
I think Ryan you must make a small change in the 3rd step. Instead of themes it will be plugins :)
Reply
Kenneth said 4:49PM on 10-16-2006
Thanks, Ryan. I have been using WP for over a year now. My web hosting is about the expire and curious about switching to another web hosting. If I ended up switching, these steps will be extremely helpful.
Anyway, I just saved a copy of the recipe.
Nice digg!
Reply
Ryan Carter said 5:11PM on 10-16-2006
Actually, changing the databases variables in the wp-config file doesn't work. That's why I recommend you do a fresh install. This is also a good way to upgrade your WordPress install while you're at it.
Reply
Mark Krynsky said 12:35AM on 10-17-2006
I just went through this very recently and more closely followed Otto's steps with the exception that I didn't do a full DB restore...in most cases I backed up and restored tables in batches. First the core ones used by WP then secondly Plugin specific. It was a good Exercise in familiarizing myself with tables plugins create which can be helpful later. In fact I realized that there were many remnant tables created by plugins that I had abandoned long ago and had no place being restored in a fresh install.
I also didn't restore the WP_Options table since I was trying to setup the new install while the old one was still running, so I A/B'd the options set from the original install to the new without changing the "Wordpress address (uri)" so I could continue to work and compare the funtionality of the two.
I know that there were many other details regarding my migration that I didn't document or are mentioning here, but these were pretty key for me.
Reply
Otto said 9:26AM on 10-17-2006
You can actually skip steps 4 and 5 if you do it right.
1. Backup your database.
2. Backup the entire site via FTP. Just get everything. All files. All folders.
3. Restore the database at your new host.
4. Modify wp-config.php (in your backup files) to point to your new database.
5. Upload the whole site to your new host. At this point, your blog should work in the new location.
6. Tweak anything that may be really custom to your old host's setup. Most people won't have anything else to tweak here.
It's not that tricky, really.
Reply
koan said 1:29PM on 10-18-2006
Thanks. But what if I have a blog hosted in WordPress.com servers and I need to move to my own host? I can't play with PHPmyAdmin into WP hosting servers...
Reply
Abhijit Nadgouda said 12:21PM on 10-20-2006
Koan, I recently moved my blog from wordpress.com to self-hosted one. I have put down things I had to do in my blog.
Reply
Abhijit Nadgouda said 12:24PM on 10-20-2006
Sorry, the comment got cut out. You will basically have to export your posts+comments using RSS and then import them in your self-hosted blog. There are some minor problems, but they can be handled manually. A more detailed explanation is here http://ifacethoughts.net/2006/08/21/the-new-avatar-or-moving-from-wordpresscom/.
Reply
PiggyBob said 9:19AM on 11-30-2006
That;s a lot of job, I tend to use cpanel hosting using which I can simply copy site from remote server to my new server.
Reply
Mr.byte said 11:45PM on 3-20-2007
Hi, I just moved my contents to my new server but the pages are swinging between two servers... I mean when I open first time, the page is retrieved from old server and the next time from new server and later sometime from the old server...But in my DNS i have given only my new servers's name... Can you explain how long will it take to stabilize?
Reply
Investing Money said 11:27PM on 3-24-2007
Great article. For some reason, I couldn't understand the Wordpress Method. Your explanation is so easy to follow.
Reply
Car Insurance said 8:07AM on 3-25-2007
Good steps, I run a WordPress blog myself, and soon moving to a new host. This will be a handy guide. Thank you!
Reply
jw said 5:36PM on 6-12-2007
Thanks for the info. I have seen tons of blogspot info but little for wordpress!
http://www.getftp.info
Reply
nxghosting said 3:42PM on 5-23-2008
Hi guys !! Nice recipe.......I am going to try this out.....will post angain if i have some problem.....
One more thing......give a try to our web hosting service if http://nxghosting.com ....we provide the best support ever.
Reply
sezione said 3:09AM on 7-03-2008
http://pe-mess.info
Reply
www.redips.net | Moving WordPress said 6:51AM on 11-25-2008
Nice post. Actually I copied WordPress site from production host to local computer. This way I have two installation of WordPress. I can play with local host installation or experimenting with modules before publishing. I also write post on local host and after finishing - copy&paste to the production site. If you are interested, please read a little cookbook at www.redips.net.
Thank you!
Reply
Data Entry India said 9:45AM on 11-29-2008
Data Entry India, Data Entry Company India, Data Entry Services, Ecommerce Data Entry, Data Mining, Data Processing, Internet Research, Data Entry
Reply
Data Entry India said 5:33AM on 11-30-2008
Data Entry India, Data Entry Company India, Data Entry Services, Ecommerce Data Entry, Data Mining, Data Processing, Internet Research, Data Entry Outsourcing, Data Entry In India, Online Data Entry India
Reply