Migrate WordPress Site to New Host: A Complete Step-by-Step Guide

Migrate WordPress Site to New Host: A Complete Step-by-Step Guide

By:

Date:

Migrate your WordPress site by backing it up, moving the files and database, updating configuration settings, testing on the new server, and only then switching DNS. Do not point your domain to the new host until the site works correctly in a temporary preview or staging URL.

TLDR: A safe WordPress migration follows a clear order: backup, copy files, export the database, import it on the new host, update wp-config.php, test, then change DNS. For example, a small business site with 2.4 GB of files and a 180 MB database can often be moved in 30 to 90 minutes, but DNS may take up to 24 hours to fully update. In one common case, an online store that gets 3,000 visits per day should schedule migration during its lowest traffic window to reduce failed orders and missed form submissions.

Before You Start: Prepare the Migration

Preparation prevents most migration problems. A rushed move can break images, forms, logins, payment pages, and admin access. Honestly, it feels like some hosting panels hide the useful tools three clicks deeper than they should, so give yourself extra time.

Before touching files, collect these details:

  • Current hosting login with file manager or FTP access.
  • New hosting login with database and domain tools.
  • WordPress admin login for plugin and site checks.
  • Domain registrar login so you can update nameservers or DNS records.
  • FTP or SFTP details for both old and new servers.

Also check your PHP version, WordPress version, and database type. If your old host runs PHP 7.4 and the new host defaults to PHP 8.3, some older themes or plugins may fail. Match versions first, then upgrade later after testing.

Step 1: Put the Site in a Clean State

Before migration, update WordPress core, themes, and plugins if the site is stable. If the site already has errors, do not update everything at once. That can make troubleshooting harder.

Delete unused plugins and themes. Clear cache from caching plugins. Remove old backup archives if they are stored inside wp-content. These files can add several gigabytes to the transfer for no good reason.

If you run WooCommerce, membership software, bookings, or forms, plan carefully. New data can arrive while the move is happening. Put the site in maintenance mode during the final sync, or temporarily pause checkout and form submissions.

Step 2: Create a Full Backup

A full WordPress backup includes two parts:

  1. Website files, including WordPress core, themes, plugins, uploads, and custom files.
  2. The database, including posts, pages, settings, users, orders, comments, and plugin data.

You can create a backup with a plugin, your hosting control panel, or manual FTP and database export. Trusted backup plugins can work well for smaller sites. For large sites, manual migration is often more reliable.

Download the backup to your local computer or secure cloud storage. Do not trust a backup that exists only on the old server. If that server fails or the account closes, you may lose your recovery option.

Step 3: Download WordPress Files

Use SFTP if possible. It is more secure than plain FTP. Connect to the old host and download the full WordPress directory. This is often the public_html, www, or domain-specific folder.

Make sure these key items are included:

  • wp-content folder
  • wp-config.php file
  • .htaccess file, if the server uses Apache
  • Any custom verification files, such as Google Search Console files
  • Custom folders outside the standard WordPress structure

Expect to waste time on hidden files if your FTP client does not show them by default. The .htaccess file is a common one people miss. Without it, permalinks may return 404 errors after the move.

Step 4: Export the WordPress Database

Most hosts provide phpMyAdmin or a similar database tool. Open the database used by WordPress, choose Export, and select SQL format. For many sites, the quick export option is enough.

If the database is large, use a compressed export such as gzip. If phpMyAdmin times out, use your host’s backup tool or command line export. A database over 500 MB can fail through browser-based tools.

To confirm the correct database, open the old wp-config.php file and check this line:

define('DB_NAME', 'your_database_name');

Step 5: Create a New Database on the New Host

Log in to the new hosting control panel. Create a new MySQL or MariaDB database, then create a database user. Assign that user full permissions for the new database.

Save these four values:

  • Database name
  • Database username
  • Database password
  • Database host, often localhost, but not always

Use a strong password. Avoid reusing the old database password. Migration is a good time to improve basic security.

Step 6: Upload Files to the New Host

Connect to the new host with SFTP. Upload the WordPress files into the correct web root folder. This may be public_html, htdocs, or a folder named after your domain.

If the new host already installed a blank WordPress site, do not blindly overwrite it unless you know what you are replacing. In most cases, it is cleaner to remove the blank install first, then upload your real site files.

Image not found in postmeta

Step 7: Import the Database

Open phpMyAdmin on the new host. Select the empty database you created. Choose Import, upload the SQL file, and run the import.

If the import fails, check the error message. Common causes include upload size limits, timeout limits, or incompatible SQL settings. Ask the new host to raise limits or import the file for you. A serious host should handle this without drama.

Step 8: Update the wp-config.php File

Open wp-config.php on the new server. Update the database settings to match the new database details:

define('DB_NAME', 'new_database_name');
define('DB_USER', 'new_database_user');
define('DB_PASSWORD', 'new_database_password');
define('DB_HOST', 'localhost');

Save the file. If the database host is not localhost, use the exact value provided by your host. A wrong database host usually causes the “Error establishing a database connection” message.

Step 9: Test Before Changing DNS

This step matters. Test the site on the new server before sending visitors there. Many hosts provide a temporary URL or preview link. You can also edit your computer’s hosts file to point the domain to the new server IP for private testing.

Check these areas:

  • Homepage and main service pages
  • Blog posts and categories
  • Images and media files
  • Contact forms
  • Login and admin dashboard
  • Checkout, cart, and payment flow for stores
  • Permalinks and redirects
  • Mobile layout

If pages show 404 errors, go to Settings > Permalinks in WordPress and click Save Changes. This refreshes rewrite rules. It fixes the issue more often than it should, which is annoying, but it works.

Step 10: Search and Replace URLs if Needed

If the domain name stays the same, you may not need a URL replacement. If you moved from a temporary domain, staging domain, or old domain, update URLs in the database.

Use a reliable search and replace tool made for serialized WordPress data. Do not use a basic text editor on the SQL file unless you are certain it will not corrupt serialized values.

Typical replacements include:

  • http://oldsite.com to https://newsite.com
  • http://example.com to https://example.com
  • Temporary host URLs to the final domain

Step 11: Point the Domain to the New Host

Once testing passes, update DNS. You can change nameservers to the new host, or update the A record to the new server IP. The best option depends on where you want DNS managed.

Lower the DNS TTL before migration if possible. Set it to 300 seconds several hours ahead of the move. This can speed up the switch. If you forget, the change may still work, but some visitors may reach the old server for longer.

Step 12: Enable SSL and Force HTTPS

After DNS points to the new host, issue an SSL certificate. Many hosts offer free SSL through Let’s Encrypt. Once active, confirm the site loads through https://.

Then force HTTPS using your hosting panel, WordPress settings, or a trusted SSL plugin. Check for mixed content warnings. These happen when images, scripts, or styles still load over HTTP.

Step 13: Run Final Checks

After the move, check performance, security, and tracking. Confirm Google Analytics, ads pixels, email forms, SMTP, backups, and caching. If the site uses a firewall or CDN, update the origin server IP there too.

Keep the old hosting account active for at least 7 to 14 days. This gives you time to recover missed files or compare settings. Do not cancel it immediately after DNS changes.

Common Mistakes to Avoid

  • Changing DNS too early: This can send visitors to a broken site.
  • Forgetting the database: Files alone are not a WordPress site.
  • Missing hidden files: The .htaccess file can affect redirects and permalinks.
  • Ignoring email: Moving web hosting can affect mail records if DNS is changed.
  • Skipping backups: A migration without a backup is an unnecessary risk.

Manual Migration vs Migration Plugin

A migration plugin is fine for many small and medium sites. It can package files and the database into one archive. The process is faster and easier.

Manual migration gives more control. It is better for large sites, custom setups, restricted servers, and cases where plugins time out. If the site earns money or stores customer data, manual checks are worth the extra effort.

The safest rule is simple: never treat migration as complete until the site has been tested on the new host, SSL works, forms send correctly, and backups run on schedule. A careful WordPress migration is not complicated, but it must be done in the right order.

Categories:

Tags:

Leave a Reply

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