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.
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.