Moving a WordPress site from another host

Copy a WordPress site here over SSH or from a backup file, test it before moving DNS, and fix pages that show errors.

Hostctl can copy a WordPress site from your old host in two ways: straight from the old server over SSH, or from a backup file you download there and upload here. SSH is quicker when your old host offers it.

Both start on the domain's WordPress tab with Import from another server, then From another server or From a backup file. Add the domain here first (see Adding a domain), but leave its DNS pointing at the old host until you've tested the copy.

The site can go into the domain, a subdomain, or a New subdomain… created for it. The folder must be empty; Hostctl's placeholder page is fine. The import creates a new database for the site, so the server needs MySQL or MariaDB.

Importing over SSH

The old server needs:

  • an SSH account that can run commands. SFTP-only accounts don't work.
  • tar, gzip, mysql and mysqldump, which cPanel, Plesk and most VPS hosts have.
  • a wp-config.php that sets the database the usual way, in the WordPress folder or the folder above it.

Then:

  1. Fill in WordPress folder on the old server, Old server (SSH), SSH port and SSH username.
  2. Under Sign in with, choose Password or Private key and fill in the matching box. It's used for this import only and never saved.
  3. Press Check connection. Hostctl signs in and reports the WordPress version, the site's address, and the size of its files and database.
  4. Compare the SSH key fingerprint it shows with the one your old host publishes, if it does.
  5. Press Import.

Each user can run 10 connection checks an hour.

Finding the WordPress folder

It's the full path of the folder that holds wp-admin, wp-includes and usually wp-config.php. On cPanel it's often /home/user/public_html; on Plesk, /var/www/vhosts/example.com/httpdocs. If you're not sure, sign in to the old server over SSH, go to the folder with cd, and run:

pwd

Checking the old server's key fingerprint

Check connection lists the old server's SSH keys as fingerprints such as ssh-ed25519 SHA256:…, and marks the one the import will use. If your old host shows its server fingerprints (in its control panel or documentation), they should match. If they don't, stop: you may not be talking to your real server.

If the key changes between the check and the import, the import stops. Press Check connection again.

Importing from a backup file

Use this when the old host has no SSH. Make an archive that holds:

  • the WordPress files, including wp-config.php, and
  • a database export, as a .sql or .sql.gz file.

A .zip of the site's folder with the .sql export inside works, and so does a full cPanel backup. The archive can be .zip, .tar, .tar.gz or .tgz, up to 5 GB, and the server needs room for it plus about 2 GB.

  1. Under Upload the backup, choose the file. Keep the page open while it uploads; nothing is changed yet.
  2. Under Choose where it goes, pick Import into.
  3. Press Import.

The uploaded file is deleted once the import has used it. Remove discards it before then.

If the import says "The backup has no database dump (.sql or .sql.gz) next to the WordPress files", the archive is missing the export. Export the database at the old host (phpMyAdmin's Export works), add the .sql file to the archive and upload it again.

What the import changes

  • The site's address is changed to its new one everywhere except post GUIDs.
  • wp-config.php is pointed at the new database. The table prefix stays.
  • References to the old server's folder are updated, where Hostctl can tell what that folder was.
  • An object cache plugin file (wp-content/object-cache.php) is switched off, since its cache server isn't here.
  • Cache folders and backup plugins' archives aren't copied.

If the copy fails, everything it created is removed again.

Testing before you move DNS

Point only your own computer at the new server, using its hosts file. Add a line with the server's address (the A record in the domain's DNS Manager) and the site's names:

203.0.113.7 example.com www.example.com

On macOS and Linux the file is /etc/hosts (edit it with sudo). On Windows it's C:\Windows\System32\drivers\etc\hosts, edited as administrator.

Browse the site, sign in to wp-admin, and check forms and checkout. Then remove the line, move the domain's DNS, and request its certificate (see Getting an HTTPS certificate).

A site imported before the domain has a certificate gets an http:// address. Once the certificate is active, change it in WordPress under Settings → General.

The import reports pages with errors

After importing, Hostctl loads the home page and the sign-in page. If either fails, the site is kept and Activity says "Imported, but some pages show errors", followed by home, login or both.

Look first at plugins tied to the old host, such as caching or security plugins that stored the old server's settings. Turn on Debug log on the site's card, reload the page, and open View log to see the error. If you can't reach wp-admin, rename the plugin's folder in wp-content/plugins (with the domain's Files page or FTP) to switch it off.