How to Migrate a WordPress Site to a New Host
Move a WordPress site to new hosting with a migration plugin or by hand: back up, copy files and database, update wp-config.php, search-replace URLs if needed, test, then switch DNS.

Table of Contents
To move WordPress to a new host: back up the site, copy the files and database to the new hosting, update wp-config.php with the new database details, test the site on the new server before changing DNS, then point the domain to the new host. You can do it with a migration plugin (easiest for most sites) or manually (more control, works for any size). Keep the old hosting active until everything is confirmed.
The general planning (TTL, inventory, email) is covered in how to move a website to a new host without downtime; this tutorial covers the WordPress-specific steps.
Before you start
- Update WordPress, themes and plugins on the old site.
- Take a full backup and download it. See WordPress backups.
- Set up the new hosting with a matching or newer supported PHP version.
- Lower your DNS TTL a day in advance. See DNS propagation explained.
Method 1: With a migration plugin
Migration plugins package files and the database into an archive and restore it on the new site, handling URL replacement automatically.
- On the old site, install a reputable migration plugin and create an export (a full archive).
- Download the archive.
- On the new hosting, install a fresh WordPress (see how to install WordPress in cPanel), using a temporary URL or the hosts-file method so you can reach it.
- Install the same migration plugin on the new site and import the archive.
- Log in again (the user accounts are now those from the old site) and re-save Settings → Permalinks.
Watch for size limits in free plugin versions and upload limits on the new server.
Method 2: Manual migration
Step 1: Copy the files
Download the entire WordPress directory from the old host (FTP or a cPanel backup), especially wp-content and wp-config.php, and upload it to the new hosting's document root. See how to upload website files.
Step 2: Export the database
On the old host, open phpMyAdmin, select the database, choose Export, and save the SQL file (use compression for large databases). Or use WP-CLI: wp db export.
Step 3: Create the database on the new host
Create a new database and user with all privileges; see how to create a MySQL database in cPanel. Then Import the SQL file in phpMyAdmin.
If the import fails with an unknown collation error (for example utf8mb4_0900_ai_ci when moving from MySQL 8 to MariaDB), replace that collation in the SQL file with a supported utf8mb4 collation and import again. See MySQL vs MariaDB.
Step 4: Update wp-config.php
Edit DB_NAME, DB_USER, DB_PASSWORD and DB_HOST to match the new database. Keep $table_prefix the same as the old site.
Step 5: Change URLs only if the domain changes
If the site keeps the same domain, you do not need to change URLs. If the domain or protocol changes, use a tool that handles serialised data, such as WP-CLI:
wp search-replace 'https://old-domain.com' 'https://new-domain.com' --skip-columns=guid
Do not use a plain text find-and-replace on the SQL file for URL changes, because it can break serialised settings.
Test before switching DNS
Point your computer to the new server with a hosts-file entry, then check:
- home page, posts, images and menus;
- logging in to
/wp-admin/; - forms and email sending;
- for WooCommerce, a test order;
- SSL works (issue a certificate on the new host);
- no errors in the error log.
Viewing the new site before DNS changes: the hosts file
To test the site on the new server while the world still sees the old one, map your domain to the new server's IP on your own computer only:
| System | Hosts file location |
|---|---|
| Windows | C:\Windows\System32\drivers\etc\hosts (edit as Administrator) |
| macOS and Linux | /etc/hosts (edit with sudo) |
Add a line such as:
203.0.113.10 example.com www.example.com
Save, close and reopen the browser, then visit the site. Everything you see is now served by the new host. When finished, remove the line, otherwise your computer will keep using the new server even if you later switch back.
Common migration problems
| Symptom | Likely cause | Fix |
|---|---|---|
| Images missing | wp-content/uploads not fully copied |
Copy the uploads folder again |
| Redirects to the old domain | siteurl and home still point there |
Update them, or run a search-replace |
| "Error establishing a database connection" | Wrong credentials in wp-config.php |
Correct DB name, user, password, host |
| Permalinks give 404 | .htaccess missing or not readable |
Re-save Settings → Permalinks |
| Emails from the site not arriving | New server's sending not authorised | Update SPF/DKIM or use authenticated SMTP |
| Plugin licence errors | Licence tied to the old server or domain | Reactivate the licence |
Switch DNS and finish
- If the site changes often, pause changes and do a final database export/import.
- Update the A record or nameservers to the new host; see how to point a domain to hosting.
- Check the site from different networks as DNS updates.
- Re-save permalinks and clear any caches.
- Keep the old hosting for at least a few days, then cancel it.
Frequently Asked Questions
Will my SEO be affected?
Not if the URLs stay the same and the site stays available and fast. Changing domains needs 301 redirects; see website redesign without losing SEO.
Do I need to reinstall plugins?
No. Plugins are copied with wp-content. Premium plugins may need their licence reactivated on the new domain.
Why can't I log in after migrating?
Usually a URL mismatch or cached cookies. Check siteurl and home in the wp_options table and clear cookies. See WordPress login problems.
Related reading
See WordPress hosting: what it is and how to choose. Moving to ServerNeed? Compare WordPress hosting and contact support about migration help.
Sources
Last updated 7 October 2026



