How to backup and restore a WordPress hosted website

Background

There are various ways of backing up and restoring your WordPress website, including using a WordPress Plugin or directly from a control panel such as cPanel or Virtualmin.

What sets WordPress backup plugins apart is their ability to do migrations, versus backups. Clearly a backup should be a trivial process, something that just needs to happen, be easy, and be free. A critical function though. A migration, on the other hand, is more complex. WordPress, and a lot of other web based software, sometimes stores URLs in a fixed format. For example, an imagine might be stored as https://sitename.domain.com/wp-content/uploads/myimage.png. The problem is if you want to “backup” sitename to sitename2, you end up with a problem. All images that were referred to as https://sitename won’t just automatically change to https://sitename2.

WordPress backup programs refer to this as a “migration” and a migration is often a premium (ie. you have to pay for it) feature.

Now that backup versus migration is out of the way, here is our current list of easy to use backup (and migration) programs:

WordPress Plugins

Backup-Migration by Migrate

As of 2023 we hear good things about this one.

All-in-One WP Migration

We are quite happy with All-in-One WP Migration which is free to use if you just want to download a backup file to your local computer. The backup file can be uploaded to any WordPress instance with the plugin installed. If you would like to backup to FTP, Dropbox, Google Drive or other online services you can purchase extensions for the relevant services.  All-in-One WP Migration is also great if you want to migrate your site from one server or web address to another (e.g. from development to production). It can automatically rename all the references in the database from the old web address to the new one. So All-on-One is great for both backups, and migration.

The one oddity about All-in-One WP Migration is that it pushes you to a premium feature if you server limits are low. The solution here is to rather speak to your webhost (the company that does your WordPress hosting), so that they can raise the limits. Take note though, backups can easily reach 100s of megabytes so a host won’t just easily make these limits very large values.

client intended to send too large body

You can’t just upload any size file to a server, so watch out for the message below if using All-One WP Migration. This error will appear in your server error log file.

`2019/07/22 20:22:37 [error] 26641#26641: *36 client intended to send too large body: 267479414 bytes, client: 156.x.x.x, server: yyy.hostname.com, request: "POST /wp-admin/admin-ajax.php?action=ai1wm_import HTTP/1.1", host: "yyy.hostname.com", referrer: "http://yyy.hostname.com/wp-admin/admin.php?page=ai1wm_import"`

The way to fix it, is to find the NGINX configuration file for this particular website. This file can often be found in:

/etc/nginx/sites-available/

Once you have found the file, add client_max_body_size or modify it to have a larger value such as the example below:

server {
   client_max_body_size 300M;

After adding that setting to the server block, reload NGINX with service nginx reload

Installation Stuck at 100%

Follow these instructions, you have to install both the plugin and the extension.

Install Instructions for File Extension

UpdraftPlus

UpdraftPlus also simplifies backups and restoration. The plugin has over two million currently-active installs and is one of the world’s highest ranking and most popular scheduled backup plugins. There are options to backups into the cloud and restore with a single click.

The biggest problem with UpdraftPlus, as with quite a few other WordPress backup programs, is you can’t “migrate” a site. A migration is coined when you move form URL1 to URL2, e.g. you’re moving from https://dev1.mysite.com to https://dev2.mysite.com. Even if you site remains exactly the same, the backup software (and WordPress) see this as a new URL and there not a back – rather a migration. The reason is behind the scenes many URLs that possibly had https://dev1 hardcoded now needs to be updated to have https://dev2.

This really sets backup programs apart from each other. In the case of UpdraftPlug, you have to pay for this privileges.

Another drawback of UpdraftPlus is it creates up to 5 files per backup. Why they couldn’t just had a button that said “do full backup” is beyond me.

Migrate Guru

Some of our client swear by Migrate Guru.

Virtualmin Control Panel

The Virtualmin Control Panel has a backup feature built in where you can back up the complete site including the database to the following destinations:

  • Local File or Directory
  • FTP Server
  • SSH Server
  • Webmin Server
  • Amazon S3 Bucket
  • Rackspace Cloud Files
  • Download in Browser

Migrating – The Manual Way

You can also migrate a WordPress website from one domain to another by manually modifying 1 configuration file and doing 4 database updates.

In /wp-config.php

define( 'WP_HOME', 'https://newurl' );
define( 'WP_SITEURL', 'https://newurl' );

Run these four queries:

UPDATE wp_options SET option_value = replace(option_value, 'oldurl', 'newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'oldurl','newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'oldurl', 'newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldurl','newurl');

References

 

Share this article

Leave a Reply

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

Scroll to Top