How to move a WordPress website with a plugin or by hand — files, database, wp-config.php, changing the site address, testing before you switch the domain and common errors after the move.
Contents
There are two ways to move WordPress: with a plugin, which is quicker for a small website, or by hand, which is more reliable for a large one. Either way, switch the domain last, once the website is already working in its new home.
Method 1: with a plugin
Migration plugins — Duplicator, All-in-One WP Migration and similar — pack the files and database into a single archive and unpack it again on the new host.
- On the old website, install the plugin and create an archive.
- On the new host, install a clean copy of WordPress in one click (Softaculous in cPanel) and install the same plugin.
- Upload the archive and start the restore.
Free versions of these plugins sometimes limit the archive size. If your website is large, it is easier to move it by hand.
Method 2: by hand
- Download all the website files as a single archive and export the database in phpMyAdmin (the Export tab).
- On the new host, upload the files to
public_html, create a database and a user, and import the export into the database. - In
wp-config.php, enter the new database name, user and password.
define( 'DB_NAME', 'username_wp' );
define( 'DB_USER', 'username_wp' );
define( 'DB_PASSWORD', 'new-password' );
define( 'DB_HOST', 'localhost' );On our hosting, database and user names start with your cPanel username. Each step is described in detail in How to move your website to us.
If the website address changes
WordPress stores the website address in the database — in its settings and in every link inside your posts. If the domain or protocol changes (for example from http to https), replace the address throughout the database. The easiest way is the Better Search Replace plugin: run it in dry-run mode first and it will show how many replacements it would make. If you work over SSH and the server has WP-CLI, this command does the same:
wp search-replace "http://old.example.com" "https://example.com" --dry-run
wp search-replace "http://old.example.com" "https://example.com"A simple find and replace in the export file won’t do: WordPress stores some settings in serialised form, and editing them this way breaks them.
Test before you switch the domain
You can view the website on the new host while everyone else still sees the old one by editing the hosts file on your own computer — see the article on moving a website for how. When everything works, switch the domain: How to point a domain at your hosting.
Common errors after the move
| What you see | What to do | |||
|---|---|---|---|---|
| Error establishing a database connection | check the database name, user and password in wp-config.php; the user must be added to the database | |||
| A white screen or a 500 error | choose the same PHP version as before: | PHP version | ; see also | Error 500 |
| The home page opens, but other pages give a 404 | in the WordPress dashboard: Settings → Permalinks → Save Changes — WordPress will rewrite .htaccess | |||
| No images, and the browser complains about HTTPS | Mixed content on HTTPS | |||
| Question marks or garbled characters instead of accented or non-Latin letters | Garbled characters instead of letters |
Didn’t find the answer? Ask our support team — we’ll help.