So you need to move WordPress to new host. Maybe your current hosting is slow, unreliable, or expensive. Maybe you've outgrown shared hosting and you're moving to a VPS. Whatever the reason, the migration itself shouldn't cause downtime or data loss — if you follow the right steps.
I've migrated hundreds of WordPress sites. The process is actually straightforward once you understand the sequence. The mistakes people make aren't technical — they're about doing steps in the wrong order. Particularly the DNS part.
Here's the complete process, step by step.
Before you start: the zero-downtime principle
The key to a zero-downtime migration: keep your old host running until the new one is fully working. Don't cancel your old hosting first. Don't change DNS first. Set up everything on the new server, test it thoroughly, then switch DNS as the last step.
Your old site stays live the entire time. Visitors don't notice anything.
Step 1: Set up the new server
On your new host, install the full stack your WordPress needs:
bash# For Ubuntu 22.04/24.04 VPS: sudo apt update && sudo apt upgrade -y sudo apt install nginx mysql-server php8.3-fpm php8.3-mysql php8.3-xml php8.3-mbstring php8.3-curl php8.3-zip php8.3-gd php8.3-intl php8.3-redis redis-server -y
Create your database:
bashsudo mysql -e "CREATE DATABASE wordpress_db;" sudo mysql -e "CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'your_strong_password';" sudo mysql -e "GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wp_user'@'localhost';" sudo mysql -e "FLUSH PRIVILEGES;"
Configure Nginx with a server block for your domain. Don't worry about SSL yet — we'll handle that after DNS switches.
Step 2: Export your database from old host
Using WP-CLI (best method):
bashwp db export backup.sql --add-drop-table
Using mysqldump:
bashmysqldump -u username -p database_name > backup.sql
Using phpMyAdmin: Go to your database → Export → Quick → Go. Download the .sql file.
The database contains all your posts, pages, comments, settings, and plugin data. This is the critical piece.
Step 3: Copy all WordPress files
Using rsync (fastest for large sites):
bash# From old server to new server: rsync -avz --progress /var/www/html/ newuser@new-server-ip:/var/www/html/
Using SFTP:
Download the entire wp-content folder and WordPress core files from old host. Upload to new host.
What must be copied:
wp-content/uploads/— all your media fileswp-content/themes/— your active themewp-content/plugins/— all pluginswp-config.php— your configuration (you'll edit this)- WordPress core files
The wp-content/uploads folder is usually the largest. A site with years of images can be 5–20GB. Start this transfer early — it takes time.
Step 4: Import database on new server
bashmysql -u wp_user -p wordpress_db < backup.sql
This imports all your content into the new server's database.
Step 5: Update wp-config.php
Edit wp-config.php on the new server to match the new database credentials:
phpdefine('DB_NAME', 'wordpress_db'); define('DB_USER', 'wp_user'); define('DB_PASSWORD', 'your_strong_password'); define('DB_HOST', 'localhost');
Everything else in wp-config.php (salts, table prefix, debug settings) stays the same.
Step 6: Test on new server BEFORE changing DNS
This is the step most guides skip, and it's the most important one. You need to verify the site works on the new server while the old server is still live.
Edit your local hosts file:
On Mac/Linux:
bashsudo nano /etc/hosts # Add this line: NEW.SERVER.IP.ADDRESS yourdomain.com www.yourdomain.com
On Windows: edit C:\Windows\System32\drivers\etc\hosts
Now when YOU visit yourdomain.com, your browser goes to the new server. Everyone else still sees the old server.
Test everything:
- Homepage loads correctly
- Images display (check uploads folder was copied fully)
- Login to wp-admin works
- Create a test post (draft, don't publish)
- Check plugin functionality
- Test forms, WooCommerce checkout if applicable
- Check mobile layout
Fix any issues now, while the old server is still serving visitors. Common problems at this stage:
- Missing images → uploads folder didn't copy completely
- Broken permalinks → Nginx needs rewrite rules (add
try_files $uri $uri/ /index.php?$args;) - Database connection error → wp-config.php credentials don't match
Step 7: Lower DNS TTL (do this 24–48 hours before)
This step should actually happen before the migration day. Go to your DNS provider and lower the TTL (Time To Live) on your A record to 300 seconds (5 minutes). This means when you change the IP, the change propagates in minutes instead of hours.
bashType: A Name: @ Value: old-server-ip TTL: 300
Wait at least 24 hours after lowering TTL before proceeding to the DNS switch. Old TTL values need to expire from DNS caches worldwide.
Step 8: Final sync before DNS switch
Between when you first copied files and now, visitors may have added new content (comments, orders, media uploads) on the old server. Do a final sync:
bash# Final database export from old server wp db export final-backup.sql --add-drop-table # Final rsync for new uploads rsync -avz --progress /var/www/html/wp-content/uploads/ newuser@new-server-ip:/var/www/html/wp-content/uploads/
Import the final database on the new server:
bashmysql -u wp_user -p wordpress_db < final-backup.sql
For WooCommerce stores: do this during a low-traffic window. Any orders placed between your final sync and DNS switch need to be manually verified.
Step 9: Switch DNS
Update your A record to point to the new server IP:
bashType: A Name: @ Value: NEW-SERVER-IP TTL: 300
If you have a www subdomain:
bashType: A (or CNAME) Name: www Value: NEW-SERVER-IP (or yourdomain.com)
With TTL at 300 seconds, most visitors will reach the new server within 5–15 minutes. Some DNS resolvers cache aggressively, so allow up to 2 hours for full propagation.
Step 10: Install SSL on new server
Once DNS is pointing to the new server:
bashsudo apt install certbot python3-certbot-nginx -y sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
Certbot automatically configures HTTPS in your Nginx config and sets up auto-renewal.
Step 11: Remove hosts file entry and verify
Remove the line you added to /etc/hosts in Step 6. Now verify the site works through normal DNS resolution.
bash# Verify DNS is pointing to new server dig yourdomain.com +short # Should show new server IP # Test TTFB on new server curl -o /dev/null -s -w "TTFB: %{time_starttransfer}s\n" https://yourdomain.com
Step 12: Keep old hosting active for 7–14 days
Don't cancel your old hosting immediately. Keep it running for at least a week as a safety net. If anything goes wrong, you can switch DNS back to the old server in minutes.
After 7–14 days with no issues, cancel the old hosting.
Common migration mistakes
Canceling old hosting before testing new server. If the new server has problems, you have no fallback. Always overlap.
Forgetting search-replace for URLs. If your old URL was http:// and new is https://, or if you're changing domains, you need a search-replace in the database:
bashwp search-replace 'http://olddomain.com' 'https://newdomain.com' --all-tables
Not copying .htaccess or Nginx config. If you had custom redirect rules on the old server, they need to be recreated on the new one.
Permissions. WordPress needs write access to wp-content/uploads:
bashsudo chown -R www-data:www-data /var/www/html/wp-content sudo chmod -R 755 /var/www/html/wp-content
Moving to HostAccent?
If you're migrating to a HostAccent VPS, the process is the same steps above. The difference is if you run into issues during migration, HostAccent support can help troubleshoot Nginx configuration, PHP-FPM settings, and database import problems — the application-level stuff that infrastructure-only hosts won't touch.
Don't stay on slow or unreliable hosting because migration feels scary. The process is a few hours of work for years of better performance.
Related guides from HostAccent
- WordPress Website Launch Checklist: 25 Practical Steps Before You Go Live
- SSL Certificate Management Guide: Setup, Renewal, and SEO Impact
- Linux VPS Security Baseline (Ubuntu 24.04): First 30 Minutes Setup
- Shared Hosting vs VPS: When Should You Switch? (Honest Guide)
- WordPress Hosting Buying Guide (2026): How to Choose the Right Plan for Growth









Discussion
Have a question or tip about this topic? Share it below — your comment will appear after review.