What was once a great deal might no longer be so great, but this is the way things go when paying for hosting. Perhaps you bought a hosting plan that gave you a year at a great rate, but now the price has tripled. The economist in you says the best thing to do is switch to a different company. The realist in you knows that it’s the best plan, but you’ve got WordPress installed and haven’t got a clue what to do to move it.
Back in the good old days, you could have figured it out. Just download your files, upload them to the new server, job done. But nowadays there are things like databases to consider, and it’s not quite so straightforward.
So how do you do it?
The Basic Principles
WordPress comes in three parts. There’s the main software itself, which includes a frontend and a backend, there’s a database of user-generated content, and there’s a directory (or folder) of supplementary files, the basis of which are uploads from the user.
The main software doesn’t need moving to a new server, as this code should not be touched by mere mortals. If you’ve been modifying the inner workings of WordPress, you probably don’t need to read this.
What does need moving is the database and the directory of user content.
The Standard Way – Backup what you have
Your hosting package will have some kind of control panel associated with it – this is the place you potentially installed WordPress from in the first place. Within the control panel, you should be able to find some reference to working with databases – it will be labeled with the word “database” or possibly “MySQL” or just “SQL”. Within this section, you should be able to find a method for backing up the database. Backup and download what you can to your computer.
Next, connect to your hosting via FTP, and download the wp-config.php file from the root of your website, and also the entire wp-content folder. By examining the config file in a text editor, you’ll be able to find the username and password for the database. The content folder contains all the files needed to run your site, including images and the theme you applied to your WordPress installation.
The Easy Way – Backup what you have
Within your control panel, there may be an option to “Back up WordPress” – you can use this.
Alternatively, you may need to install a plugin like WPClone. This plugin will perform all the tasks listed above, but it’s fully automated and will allow you to download your backup as a single ZIP file.
Both ways – move to a new server
Move your hosting to a new server. This may involve changing DNS settings or choosing different nameservers – check with your hosting provider to discover the correct procedure.
After the move is complete, log in to your new control panel and install a fresh copy of WordPress.
The Standard Way – Restore your backup
Navigate to the database section of your control panel, and import your database into the newly created database, erasing anything that was there before. Connect by FTP to the hosting, and modify the new wp-config.php file so that the username and password match the old one. Upload the wp-content folder to the new host, overwriting the content of the existing folder.
The Easy Way – Restore your backup
Log in to your new WordPress installation, and install the same plugin that you made the original backup with. Upload the backup either through the WordPress interface or via FTP. Press the button to restore the backup.
This will update the database and unzip all the content files and themes you had originally, restoring the new installation of WordPress to exactly the same settings as the old one.
Both ways – Log in to WordPress
You should now be able to log in to WordPress using the same username and password as you used for the original installation – this is because your user account is stored in the database, and the new database has been overwritten with your backed-up version.
If all has gone as planned, you should be able to log in and view your site as you would expect to see it. You may find you need to reactivate some plugins, and possibly re-enable your theme.
If it is not as intended, you may need to attempt to restore your backup again.
If you can’t log in at all or get error messages, you may need to resort to the standard method of restoring the database as there is a possibility your first attempt (or easy way attempt) failed to restore the data correctly.
If all else fails, uninstall WordPress and start again. As you have already backed up your data, you won’t lose anything by removing WordPress again.
Note that if you have transferred your site to a different domain name, you will need to do a lot more work – all the file references and hyperlinks will be coded to point to your old domain, and will need updating individually or by a plugin.
If you are at all unsure about completing this process on your own, it is best to get a professional to help you out. It is entirely possible to lose all your data during the transfer process if a file becomes corrupted during the backup, or if it is downloaded incorrectly. Always err on the side of caution, as recreating the content for your entire website is most likely a task you don’t want to undertake.
No backup method or plugin is guaranteed to work, and any plugin or technique named above is to be used at your own risk.