Webhosting | Hosting - My Hosting PartnerWebhosting | Hosting - My Hosting PartnerWebhosting | Hosting - My Hosting PartnerWebhosting | Hosting - My Hosting Partner

Restoring a Web Site from a Backup

Restoring a Web Site from a Backup
MijnHostingPartner

Restoring a Web Site from a Backup

We always recommend creating backups of your hosting space, but how does actually restoring a website from a backup file work? We'll explain that in more detail in this blog post. We will discuss what files you may be facing and how it works to restore them.

A website may need to be restored from a backup for many different reasons. This can be due to human error like deleting a page or post. Or due to the installation of an incorrect update. Restoring a backup may also be necessary if you change hosting space or for malicious reasons, such as a hack of a website. So it is advisable to not only back up your website and database. But also to learn or at least experience what it's like to restore a backup. Even without a plugin that can restore a backup for you.

What do you need to restore your website?

There are a number of tools and programs that make restoring a website and database easy, these programs will already be installed by many webmasters. If not, we recommend installing the following programs:

7zip

FileZilla or similar FTP client

Notepad++ or preferred text editor

These three programs will make it easier for you to read, edit and upload website files to the hosting space. And make sure you make fewer mistakes in the restore process. With 7zip, you can properly unzip the backup in almost all cases, and it can handle many different types of zip files. On top of that, it is an open source program that you can use for free. Without a license like WinRAR, for example. FileZilla is needed to upload the files to the right hosting area. And to make some quick edits to them. This also gives you the ability to overwrite files that are newer or larger. And can also be used to replace files with a newer or earlier version from a backup.

Further, of course you need a browser to check the site for operation, this is done with the developer tools and visually. And to go to PHPmyAdmin to restore the database.

How to create a backup

The way a backup is created also steers you in the direction of how to restore the backup. The approach we recommend is to use the Control Panel and use two scheduled tasks. These are tasks that can be done every week, day, or month to back up your site. You can set this up so that your backup files are neatly organized by date, given a unique name, and placed in a specific folder within your hosting area. We already have a knowledge base article dedicated to this topic that can be used. Set this up and get used to it by going through it, cleaning it up and checking it, say, once a month.

Backups made this way are easy to restore by downloading the latest (correct) backup files. And prepare them locally for restoration.

Restore the website files yourself with FileZilla

With the latest correct backup files, you can unzip them on your local PC using 7zip. Do this in a logical location and put some folders in the right place. After that, you can use FileZilla to connect to the hosting area where you want to restore the backup. And navigate to the wwwroot folder. This is the place where your current website files are located. If you want to replace them with the backup, all files and folders must be deleted. With the exception of web.config. Then you can transfer the backup files 1:1 from the wwwroot folder locally to the wwwroot folder in the hosting space.

Import the database again via PHPmyAdmin

After putting the website files back in place, the next step is to import the database. In most cases, it is advisable to create a new database for this instead of using an existing one. You will also need a new user for this. With new credentials. This will ensure that your database is no longer read with the same credentials as the previous settings.

Then to install the database in the new data, all you need to do is download the backup of the database again through the backup you set. And then you can restore it through PHPmyAdmin. To do this, you need to log into the new database and import the file of the old database. After that, you can see if this is successful or not. It is also possible to convert an existing MySQL database to a MariaDB. This to make better use of the speed. Again, it's just a matter of importing a MySQL database, but then into MariaDB. This is also only done through PHPmyAdmin.

Check other settings and configuration files

After you have imported the database and made it ready to use, you can check the website to see if it is ready. If it is, you should see the error message that no connection can be made to the database. This is correct because you have created new data for this. We need to process this data in the configuration files. You can do this using NotePad++ or your favorite text editor. Here, go into the WordPress wp-config.php file in the wwwroot. And adjust the database data for it. In ASP.NET, this is often directly in the web.config. And in other content management systems, in most cases, this is also either directly in the wwwroot with a config file. Or in an underlying folder. Here you set the host if it has changed, the database name, the username and the password. After that you can check if the website is available.

If your website is not yet available, this can have several reasons. Often this has to do with an incorrect version of e.g. PHP or ASP.NET. This can easily be changed in the client or in the control panel. Write permissions need to be reassigned, or there is a corrupted file somewhere. You can check this further by enabling advanced error messages in your site. And by further troubleshooting.

So with these steps, you can restore a website from a backup. This is a part that can be intimidating for newer webmasters. But we recommend that you have done it at least once. Not only will it teach you a lot about how your website works. But it will also better prepare you for when you really need to recover. It's not advisable to blindly trust a backup restore plugin. After all, it's important to know how to do such things.