Transferring a WordPress Installation across Domains

Wordpress LogoIt’s pretty easy to move your blog across domains / servers but you want to make sure you have the time to do it – so plan ahead! Also not, that if you have just registered the domain it will take time (usually 24 – 72 hours) to propagate around the web, so if you transfer before this time, your blog may be unreachable – that’s just the way the web is!

There are a couple of steps involved:

1. Backup your WordPress Database
2. Backup your server and all WordPress files
3. Change the configuration of your installation
4. Backup the new database
5. Backup the new server files
6. Transfer db and files
7. Enjoy!

Step 1 – Backup your Database
There are a number of way to do this, the easiest if your not to technically au’fay would be to get an excellent wordpress db dackup plugin:

http://www.ilfilosofo.com/blog/wp-db-backup
http://skippy.net/wordpress-database-backup

If you don’t mind jumping right on in, then most prefer something like phpmyadmin, most web hosts have this installed by default. Log in, select your db and then export, make sure the export is set to SQL and then under the options (on the right) make sure ‘Add DROP TABLE’, ‘Add AUTO_INCREMENT value’ and ‘Enclose table and field names with backquotes’ are all checked. Check ‘Data’ and ‘Complete inserts’ and ‘Use Hexadecimal for binary fields’. Check ‘Save as file’, then normally for large db’s ‘zipped’ and hit go! You now have a copy of your entire database on your computer – name it something sensible like SiteNameOLD.zip and keep it somewhere safe.

Step 2 – Backup your server and all WordPress Files
Connect up to your server via FTP and you want to dump the root of the site to your computer. There are two ways to do this:

1. Depending on your FTP client – you should just be able to ‘drag and drop’ all the files from the root of your site to your computer – this is very time consuming if you have a lot of files.

2. Use your control panel with your hosting company and find the directory with your blog in it, then compress all the files into an archive, then use FTP to take that one file off.

Make sure you get everything and then name this file something like SiteNameDumpOLD.zip. Of course if your a real genius you could use SSH, but then you wouldn’t need me explaining all of this!

Step 3 – Change your Configuration
Login to your WordPress installation and head to the options tab. Change both the URL sections to match the URL of the new diomain. ‘Update’ and expect your site to stop working :(

Step 4 & 5 – Repeating Steps 1 & 2
This is simply so you have a before and after set of files. It’s a bit anal, but at least you have every version of your site and as such can restore to any of thee states. Make sure to name these files SiteNameNEW.zip and SiteNameDumpNEW.zip.

Step 6 – Transferring the Database
If your lucky your database is hosted on a seperate database server and if it is you don’t need to change any files at all. All you need to do is transfer the contents of SiteNameDumpNEW.zip into the root of the server and you should be good to go.

If you are moving hosts it is very likely that your database username / password and location will have changed. Use phpmyadmin to import the database data taken in step 4 (this now has the new URL strings in it) and then edit the wp-config.php parameters to match your new database details. Head to to your new site URL and hey presto – migration successful!

What did we just do?
It’s simple if your think about it, we backed up the db and WordPress installation. Told our blog the new URL which rewrote all of the URL’s in the db. Transfered the new db and files to the new server. Told the blog where to find the database (wp-config.php) and away we went. This is just one way of doing it, there are many others but this is probably the most simple.

Leave a Reply

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