Performance & Hosting

How to Migrate a WordPress Site to a New Host

Step-by-step guide to safely move your WordPress website without downtime

Migrate a WordPress site to a new host can feel risky. One wrong move and you’re staring at a white screen, broken images, or lost content. The good news: if you follow a clear, step-by-step process, you can move your site with minimal downtime and zero data loss.

In this guide, you’ll learn how to migrate WordPress site to a new host using a reliable manual workflow: backing up files and the database, moving them to the new server, updating configuration, testing, and finally switching DNS. If you’re still choosing where to move, it can help to review how to choose the right WordPress hosting so you don’t migrate twice.

We’ll use tools you likely already have (cPanel, phpMyAdmin, FTP/SSH), and we’ll highlight where a migration plugin can help. By the end, you’ll have a clean, working copy of your WordPress site on a new host and a safe plan for retiring the old one.

Prerequisites for a Safe Migrate WordPress Site

Before you touch files or DNS, prepare a few essentials. This reduces the chance of downtime and makes each step faster.

  • Access to your current host: cPanel (or similar), File Manager, FTP/SFTP, and phpMyAdmin.
  • Access to your new host: cPanel or control panel login plus FTP/SSH credentials.
  • Domain registrar login: wherever you manage your domain’s DNS (could be the old host or a third-party DNS provider).
  • Disk space on the new server: Enough to hold a full copy of your existing site (files + database).
  • Local computer tools: FTP client (FileZilla, Cyberduck) and a text editor (VS Code, Notepad++, etc.).
Note: If your site is busy or runs a store, plan the migration during off-peak hours to reduce the impact of DNS propagation on visitors.

Step 1: Back Up Your WordPress Files and Database

The first and most important step is to create a full backup you can restore if anything goes wrong. You need both your WordPress files and your MySQL database.

1.1 Back up WordPress files

  1. Log in to your current host’s cPanel (or control panel).
  2. Open File Manager and locate your site’s root folder (often public_html or a subfolder like /public_html/my-site/).
  3. Select all WordPress files and folders (including wp-content, wp-admin, wp-includes, and all loose files like wp-config.php).
  4. Use the Compress option to create a single .zip archive and download it to your computer.

1.2 Back up the database

  1. In cPanel, open phpMyAdmin.
  2. Select the database used by your site (check wp-config.php for the DB_NAME constant if you’re unsure).
  3. Click the Export tab, choose Quick and SQL, then click Go to download the .sql file.
Pro Tip: For ongoing protection, set up a regular backup routine. See our separate guide on how to back up a WordPress site for long-term backup strategy ideas.

Step 2: Set Up Your New Hosting Environment

Now prepare the new server so it’s ready to receive your site. You’ll create an empty space (directory) and a fresh database on the new host.

2.1 Add the domain or site on the new host

  1. Log in to your new hosting control panel.
  2. Add your domain as a primary domain, addon domain, or within a site slot (depending on your host’s UI).
  3. Note the document root path (for example /public_html or /sites/example.com/), as you’ll upload files here later.

2.2 Create a new database and user

  1. In cPanel or your host’s tools, open MySQL Databases.
  2. Create a new database (for example example_wp).
  3. Create a new database user and set a strong password.
  4. Assign the user to the database with ALL PRIVILEGES.
  5. Write down the database name, username, and password for use in wp-config.php.
Warning: Do not point DNS to the new host yet. You should fully upload, configure, and test your site on the new server before changing name servers or A records.

Step 3: Move WordPress Files to the New Host

With the new environment ready, transfer your backed-up files from the old host to the new document root.

3.1 Upload via File Manager (simple)

  1. On the new host, open File Manager and navigate to the document root for your domain.
  2. Upload the .zip backup you created earlier.
  3. Once uploaded, select the archive and use Extract to unpack the WordPress files into the directory.

3.2 Upload via FTP/SFTP (when File Manager is limited)

  1. Open your FTP client and connect to the new host using the credentials provided.
  2. Navigate to the document root on the server side.
  3. On your local side, open the folder where you extracted the .zip backup.
  4. Select all WordPress files and drag them into the server directory to upload.
Note: Some hosts throttle large FTP transfers. If uploads are slow or time out, split your backup into smaller chunks or use the host’s File Manager instead.

Step 4: Export and Import the Migrate WordPress Site Database

You already exported the database from the old host. Now you’ll import that .sql file into the new, empty database you created.

4.1 Import via phpMyAdmin

  1. On the new host, open phpMyAdmin and select your new database.
  2. Click the Import tab.
  3. Choose your exported .sql file and leave most settings at their defaults (character set, format).
  4. Click Go and wait for the import to complete. You should see a success message and your WordPress tables (like wp_posts, wp_options) appear.

4.2 Import via command line (advanced)

If your database file is large and you have SSH access, you can import via the terminal instead of phpMyAdmin.

# Run in SSH from your hosting account
mysql -u NEW_DB_USER -p NEW_DB_NAME < /path/to/backup.sql

When prompted, enter the database user password. After the command finishes, confirm in phpMyAdmin that the tables are present.

Step 5: Update wp-config.php for the New Database

Your copied WordPress files still point to the old database credentials. Update wp-config.php on the new host so WordPress can connect to the new database.

  1. In File Manager or via FTP, locate wp-config.php in your site’s root folder on the new host.
  2. Open it in the host’s code editor or download and edit it locally in a text editor.
  3. Find the lines that define the database name, user, password, and host:
define( 'DB_NAME', 'old_db_name' );
define( 'DB_USER', 'old_db_user' );
define( 'DB_PASSWORD', 'old_db_password' );
define( 'DB_HOST', 'localhost' );
  1. Replace these with your new database credentials (and host if your provider uses a custom DB host):
define( 'DB_NAME', 'NEW_DB_NAME' );
define( 'DB_USER', 'NEW_DB_USER' );
define( 'DB_PASSWORD', 'NEW_STRONG_PASSWORD' );
define( 'DB_HOST', 'localhost' ); // or the host string from your provider
  1. Save the file and upload it back to the server if you edited it locally.
Pro Tip: Use a separate database user for each site. It’s more secure and makes future migrations or clean-ups easier.

Step 6: Test the Migrate WordPress Site Before Changing DNS

Before the world sees your site on the new host, you should test everything privately. There are two common ways: a temporary URL provided by the host or editing your local hosts file.

6.1 Use the host’s preview URL (if available)

  1. Check if your host offers a temporary URL or preview link in the control panel.
  2. Open that URL and verify that your site loads from the new server.

6.2 Use your local hosts file (more reliable)

  1. Find the IP address of your new server (often shown in your hosting dashboard).
  2. On your computer, edit the hosts file to map your domain to the new IP.
  3. Save the file, clear your browser cache, and visit your domain. Only your computer will see the new host; everyone else still sees the old one.

Walk through key pages, log in to /wp-admin, and test forms, search, and checkout (if you have eCommerce). Fix any obvious issues before moving on.

Step 7: Update DNS to Point Your Domain to the New Host

Once you’re happy with the new copy of your site, it’s time to send live traffic to it. You’ll do this by changing DNS settings at your registrar or DNS provider.

7.1 Change name servers (common with shared hosting)

  1. Log in to your domain registrar account.
  2. Locate your domain’s DNS or Name Server settings.
  3. Replace the current name servers with the ones provided by your new host.
  4. Save changes.

7.2 Or update the A record only (advanced/partial moves)

  1. If you manage DNS through a third-party provider (e.g. Cloudflare), edit the DNS zone there.
  2. Update the A record for your domain (and www if separate) to point to the new server’s IP address.
  3. Save changes and wait for DNS propagation.
Warning: DNS changes can take anywhere from a few minutes to 48 hours to fully propagate worldwide. During this time, some visitors may see the old host while others see the new one.

Step 8: Post-Migrate WordPress site Checks and Cleanup

After DNS has propagated and most visitors see the new host, do a final round of checks and clean up your old environment.

8.1 Verify everything on the new host

  • Confirm the site is loading from the new host (check server IP or a custom phpinfo() file temporarily).
  • Test logins, contact forms, search, and checkout flows.
  • Check that images, CSS, and JavaScript load correctly on critical pages.

8.2 Fix URLs and serialization issues (if needed)

If you changed the domain (for example from oldsite.com to newsite.com), run a search-and-replace on URLs using a safe tool (such as WP-CLI or a serialization-aware plugin).

# Example WP-CLI command (run via SSH on the new host)
wp search-replace 'https://oldsite.com' 'https://newsite.com' --skip-columns=guid

8.3 Decommission the old host safely

  • Keep the old hosting account active for a short buffer (a few days to a week) while monitoring for issues.
  • Once you’re confident everything works on the new host, remove the old site files and cancel the hosting plan.
Note: Never delete the old site immediately after a DNS change. Wait until you’re sure that email, SSL, and all site features are working correctly on the new host.

Wrap Up Your WordPress Host Migrate WordPress site with Confidence

Moving a WordPress site to a new host doesn’t have to be stressful. By backing up correctly, copying files and the database in an organized way, adjusting wp-config.php, testing on the new server, and only then changing DNS, you greatly reduce the risk of downtime or data loss.

With this process in place, future migrations become routine. You’ll be able to upgrade to better hosting, switch providers, or move between environments (like staging and production) while keeping your visitors and search rankings safe.

Further Reading

Frequently Asked Questions

What should I do if I see a 500 Internal Server Error after migration?

A 500 error usually indicates a PHP or server configuration problem. First, check wp-config.php for typos or extra spaces and confirm your database credentials are correct. Then temporarily disable plugins by renaming the wp-content/plugins folder and see if the site loads; if it does, re-enable plugins one by one to find the culprit. Also review the server error logs in your hosting control panel for a specific error message.

Why are my images or styles broken after moving the site?

Broken images or layouts often mean some URLs still point to the old domain or path. Check your browser’s developer tools for 404 errors on image or CSS files. If you changed the domain or directory, run a safe search-and-replace on the database to update old URLs. Also make sure your .htaccess file was copied correctly and that file permissions on wp-content are not too restrictive.

Is it better to use a migration plugin or move the site manually?

Both methods can work well. Migration plugins (like Duplicator or All-in-One WP Migration) simplify the process and are great for many beginners or smaller sites, but they can struggle with very large sites or restrictive hosts. Manual migrations give you more control, help you understand what’s happening under the hood, and are often more reliable at scale. Many professionals use a mix: plugins for simple sites and manual steps for complex or high-traffic projects.

Is it safe to leave a copy of my site on the old host after migration?

Leaving the old copy online for a short time is fine and can be helpful for rollback, but don’t leave it indefinitely. An outdated copy with old plugins or themes can become a security risk if it’s publicly accessible. After you’re confident the new host is stable and DNS has fully propagated, either remove the old site completely or lock it down with HTTP auth or an IP allowlist until you delete it.

How long will it take for the migration to fully complete for all visitors?

The technical migration steps themselves can be done in an hour or two, depending on site size and your familiarity with the tools. DNS propagation is the slower part and can take up to 24–48 hours worldwide, though many changes are visible within a few hours. During that window, some visitors may still hit the old server, which is why it’s smart to keep the old host active temporarily and avoid making content changes until propagation is complete.

Related Articles

Leave a Reply

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

Back to top button