How to backup your website

In this article you are going to learn:

  • What is a backup and why you should back up your site
  • How to backup files
  • How to backup database
  • How to restore a backup

Skill level

- Easy

Time to complete

- 20+ minutes


Creating a copy of your website data, which includes files and folders, and database, is called a backup. Imagine you have an important folder on your desktop and you want to make sure you have a copy of it in case something happens with the original one. Same thing happens here. Creating regular daily or weekly backups is great habit. 

What can go wrong? Lots of things can happen, and often its not your fault.  It could be a hosting issue, or a malware, failed plugin or theme update or just someone accidentally deleting something. A backup allows you to restore as fast as possible and avoid downtime for website visitors. Avoid any unnecessary stress.

Ideally you want to automate the process so you don't have to worry about it. It's also easy to forget. Make it automatic, you wont regret it. 

Before we start

Before I tell you how to do it yourself, my duty is to mention that majority of hosting companies offer automatic backups, usually as a paid feature. So, if you are lazy to learn and you don't worry about saving some money, you can probably just enable this option and go watch football, read a book, or whatever else would you like to do instead reading this article. There are also WordPress plugins that will automatize the process for you. However, as someone who owns or maintains a website, I advice you to learn how to do it, because, I guarantee you, it will come handy one day.

Let's start

With no further ado, here's the tutorial.

Remember the folder example? Nothing else is required here but copying all the files and folders we have. We can do this via the hosting file manager, or FTP. No matter which one you prefer, you need to:

- Navigate to root folder of your website
- Select everything
- Compress into an archive file (.zip, .rar, etc)
- Download 
TIP: Keeping the archive file on server is not recommended. After download, best practice would be to delete it from the server.

Database keeps all the website preferences, users, passwords, form inputs, and much more. Without a database, files doesn't do much for you. So, this step is also necessary, and here's how you do it:

- If your hosting has a cPanel, navigate to phpmyadmin, and if not, locate databases section and see if there's an edit or login button next to your database name
- On your left sidebar, select your database *
- Find the export button within the options and hit "Go" leaving all the settings as it is

* If you have more than one database and you are not sure which one you need to export, navigate back to your file manager, open wp-config.php file. Once open, locate the line with database name and remember what it is.

Restoring a backup

Now you have two files, archive with all your files and one with your database. Restoring is as easy as making a backup, we are just doing it the other way. 

- To restore files, go to your file manager, navigate to root directory and upload the archive. One uploaded, decompress. Have in mind that it might overwrite what's already there, so make sure to backup if necessary.
- Now go to phpmyadmin and select the database. When importing a database, it will not overwrite data that's already there, so it would be good to delete all the tables, so you don't get the double content or something. Once tables are deleted, hit the import button this time. Browse and upload database you have.

Voila! You are good to go now.

Few words more

You can use these same steps to migrate the site to another hosting. If you are doing exactly this, take a not of these couple of things:

After restoring backup, make sure to update site URL if needed. Maybe you moved your site from subdomain to main doman, or from subdirectory to root directory, or you simply changed the domain.  To fix this, follow these instructions: Some of your images or scripts can be still pointing to old domain. Make sure to update this as well.

Also, common issue after migration is permalinks. What happens is that you migrate everything and homepage looks perfect, but when you try to open another page it says that page doesn't exist. There is actually a simple fix. All you need to do is to go to Settings -> Permalinks and click the Save button. If it doesn't work, try setting default permalinks, save, then switch back to what was previously selected and save again.

Still need help? Contact Us Contact Us