How to Migrate WordPress to a New VPS in 30 Minutes (No Downtime)
If you migrated to a different domain or a subfolder, run a search-replace on the database:
# Install wp-cli first
wp search-replace 'https://oldsite.com' 'https://newsite.com' --all-tables
Step 4: Point DNS and Check
Update your DNS A record to point to the new VPS's IP. If you're using Cloudflare (you should be), this is a 30-second change in their dashboard.
The critical step: set the TTL (Time To Live) to 300 seconds (5 minutes) about 24 hours before you migrate. Default TTL is often 86400 (24 hours), which means it takes a full day for DNS changes to propagate everywhere. By lowering it ahead of time, the migration becomes nearly instant.
Test the new site by adding a local hosts entry before changing DNS:
# Windows: C:\Windows\System32\drivers\etc\hosts
# Mac/Linux: /etc/hosts
# Add: 123.456.789.0 yoursite.com
Step 5: The Moment of Truth
Once DNS propagates, test everything:
- Load pages (check for broken images/links)
- Submit a comment or contact form
- Check WordPress admin panel login
- Verify SSL (use SSL Labs or Qualys SSL Checker)
- Test with GTmetrix or PageSpeed Insights
Keep the old hosting active for at least 48 hours. If something breaks, you can switch DNS back while you debug.
Quick TL;DR
- Lower DNS TTL to 300 seconds 24 hours before migrating
- Always take a full backup (files + database) before touching anything
- Use wp-cli for database search-replace to fix URL changes
- Keep old hosting active for 48 hours as a fallback
I've migrated 7 sites between hosts in the past 3 years. Every failure taught me a step I wish I'd taken the first time.
When I first moved from shared hosting to a VPS, I made every mistake in the book. I forgot to update DNS records before the migration, lost two days of comments because I didn't export the database properly, and somehow broke the SSL certificate so badly that Chrome showed the "Not Secure" warning for three days.
It was a disaster. But I learned exactly what to do — and what not to do — the next time. I've since migrated six WordPress sites between hosts, and the last one took under 30 minutes with zero downtime.
Here's the exact process I use, step by step.
The Step-by-Step Migration Plan
Step 1: Take a Full Backup (Don't Skip This)
Before touching anything, export everything from your current host:
- WordPress files — Download via FTP/SFTP from /wp-content/ (themes, plugins, uploads) and the root WordPress files
- Database — Use phpMyAdmin or wp-cli:
wp db export site-backup.sql - .htaccess or nginx config — Copy your rewrite rules so you don't lose custom configurations
- SSL certificates — If you were using Let's Encrypt, you can reissue on the new server, so you don't need to back these up
I also recommend upgrading WordPress, plugins, and themes before migrating. A fresh move with old, vulnerable plugins is asking for trouble.
Step 2: Set Up the New VPS
On your new VPS (I used RackNerd and Hostinger in my tests), install the LEMP stack or whatever your site needs:
# Ubuntu 22.04 LEMP setup
sudo apt update && sudo apt upgrade -y
sudo apt install nginx mysql-server php-fpm php-mysql -y
sudo systemctl enable nginx mysql php8.1-fpm
Or if you prefer one-click: Hostinger's hPanel lets you install WordPress with a single button click — the server comes pre-configured. For DigitalOcean and Vultr, the one-click WordPress marketplace image works well.
Step 3: Import Your Content
Upload your backed-up files to the new server:
- WordPress files go to /var/www/html/ (or wherever your web root is)
- Import the database:
mysql -u root -p wp_database < site-backup.sql - Update wp-config.php with the new database credentials
If you migrated to a different domain or a subfolder, run a search-replace on the database:
# Install wp-cli first
wp search-replace 'https://oldsite.com' 'https://newsite.com' --all-tables
Step 4: Point DNS and Check
Update your DNS A record to point to the new VPS's IP. If you're using Cloudflare (you should be), this is a 30-second change in their dashboard.
The critical step: set the TTL (Time To Live) to 300 seconds (5 minutes) about 24 hours before you migrate. Default TTL is often 86400 (24 hours), which means it takes a full day for DNS changes to propagate everywhere. By lowering it ahead of time, the migration becomes nearly instant.
Test the new site by adding a local hosts entry before changing DNS:
# Windows: C:\Windows\System32\drivers\etc\hosts
# Mac/Linux: /etc/hosts
# Add: 123.456.789.0 yoursite.com
Step 5: The Moment of Truth
Once DNS propagates, test everything:
- Load pages (check for broken images/links)
- Submit a comment or contact form
- Check WordPress admin panel login
- Verify SSL (use SSL Labs or Qualys SSL Checker)
- Test with GTmetrix or PageSpeed Insights
Keep the old hosting active for at least 48 hours. If something breaks, you can switch DNS back while you debug.
Quick TL;DR
- Lower DNS TTL to 300 seconds 24 hours before migrating
- Always take a full backup (files + database) before touching anything
- Use wp-cli for database search-replace to fix URL changes
- Keep old hosting active for 48 hours as a fallback
I've migrated 7 sites between hosts in the past 3 years. Every failure taught me a step I wish I'd taken the first time.
I've migrated 7 sites between hosts in the past 3 years. Every failure taught me a step I wish I'd taken the first time.
One practical example from last month: I migrated a friend's photography portfolio (about 3 GB of high-res images) from a shared host to a RackNerd VPS. The WordPress export tool failed because the file was too large (180 MB export). I used wp-cli to export the database directly from the command line, then uploaded the wp-content folder via rsync. Total transfer time: 7 minutes. Database import: 12 seconds. The site loaded 2.4x faster after the move.