Tutorials

How to Migrate WordPress to a New Host Manually (Files, Database & DNS)

How to Migrate WordPress to a New Host Manually (Zero Plugins) - CpanelFree Guide
Written by Blog

Quick Answer: To migrate WordPress to a new web host manually with zero plugins: 1) Compress your WordPress root directory into a tar.gz archive, 2) Export your MySQL database via mysqldump or phpMyAdmin, 3) Extract the files onto your new host’s public_html, 4) Create a new MySQL database/user and import the SQL dump, 5) Update database credentials in wp-config.php, and 6) Update your domain DNS A record to the new server IP.

Why Manual Migrations Outperform Migration Plugins

While plugins like All-in-One WP Migration or Duplicator are popular, they frequently fail on large websites (over 500MB) due to PHP execution timeouts, web server memory limits, and paywalled restoration file size caps. Manual migration is 100% free, works on websites of any size (even 50GB+), and guarantees zero file corruption.

Step 1: Archive WordPress Files on Old Server

Connect to your old server via SSH or cPanel File Manager and compress your files:

cd /home/username/public_html
tar -czf wordpress_files.tar.gz *

Step 2: Export MySQL Database Dump

mysqldump -u old_dbuser -p --single-transaction --quick old_dbname | gzip > db_backup.sql.gz

Step 3: Transfer Files & Database to New Server

Use scp or rsync to stream data directly between servers over high-speed encrypted SSH tunnels:

scp wordpress_files.tar.gz db_backup.sql.gz root@new-server-ip:/home/newuser/public_html/

Step 4: Extract Files & Import Database on New Server

On your new server, extract the archive and restore the database:

# Extract files into public_html
cd /home/newuser/public_html
tar -xzf wordpress_files.tar.gz
rm wordpress_files.tar.gz

# Import database into freshly created target DB
gunzip < db_backup.sql.gz | mysql -u new_dbuser -p new_dbname

Step 5: Update wp-config.php Credentials

Edit wp-config.php on the new host to match your new database credentials:

define( 'DB_NAME', 'new_dbname' );
define( 'DB_USER', 'new_dbuser' );
define( 'DB_PASSWORD', 'NewSecurePassword123!' );
define( 'DB_HOST', 'localhost' );

Step 6: Preview via Local Hosts File & Cutover DNS

Edit your local computer’s hosts file (C:\Windows\System32\drivers\etc\hosts on Windows or /etc/hosts on Mac) to preview your domain on the new IP address before updating DNS. Once verified, update your domain registrar’s A record to the new server IP.

High-Speed Server-to-Server Sync via Rsync and SSH Keys

For large WordPress sites with 20GB+ of media uploads in wp-content/uploads/, downloading and re-uploading via FTP takes hours. Use rsync with delta-transfer algorithms to sync files directly across cloud servers in minutes:

# Sync wp-content directory preserving permissions and timestamps
rsync -avzP -e "ssh -p 22" /home/olduser/public_html/wp-content/ root@new-server-ip:/home/newuser/public_html/wp-content/

Fixing File Permissions and Ownership on New Server

After extracting files, reset ownership to the web server daemon user (www-data on Ubuntu / nobody or cPanel user):

# Reset file and directory permissions
find /home/newuser/public_html -type d -exec chmod 755 {} \;
find /home/newuser/public_html -type f -exec chmod 644 {} \;
chown -R newuser:newuser /home/newuser/public_html

Automating Search-and-Replace Across Serialized PHP Tables

When migrating WordPress to a new domain name or switching protocol from HTTP to HTTPS, standard SQL UPDATE queries corrupt serialized PHP objects. Always use WP-CLI search-replace:

# Dry-run test (reports changes without modifying database)
wp search-replace 'http://olddomain.com' 'https://newdomain.com' --dry-run

# Execute live search-replace
wp search-replace 'http://olddomain.com' 'https://newdomain.com' --all-tables --precise

Post-Migration Sanity Checklist

  • Verify Permalinks: Navigate to Settings > Permalinks in WordPress and click Save Changes to regenerate .htaccess rewrite rules.
  • Clear Object Caches: Flush Redis / Memcached: wp cache flush.
  • Re-Issue AutoSSL: Verify that your new server has generated a valid Let’s Encrypt / AutoSSL certificate.

Migrate to Fast Free Hosting on CpanelFree

Migrate your WordPress website to CpanelFree. Enjoy high-speed NVMe storage, cPanel control, and unmetered bandwidth at $0 cost forever.

Migrate to Free WordPress

Frequently Asked Questions

How do I update serialized URLs if I am also changing the domain name?

Use WP-CLI to perform a safe search-replace without corrupting serialized PHP arrays: wp search-replace 'https://olddomain.com' 'https://newdomain.com' --all-tables.

Verifying SSL and HTTPS Certificates After Server Migration

Once DNS propagation finishes and visitors route to your new server, verify that an active SSL certificate is provisioned. In cPanel, navigate to SSL/TLS Status > Run AutoSSL to ensure automated Let’s Encrypt certificates cover both your apex domain and www subdomain.

How can I test the migrated site without touching my domain DNS?

Add a line to your local computer’s hosts file mapping the new server IP to your domain name (e.g. 203.0.113.50 yourdomain.com). This directs only your local computer to the new host.

Pro Sysadmin Tip: Bypassing Maintenance Mode After Migration

If your site becomes stuck displaying “Briefly unavailable for scheduled maintenance”, delete the temporary .maintenance file in your WordPress root directory to restore public access immediately.

Executing manual WordPress migrations gives developers complete control over file integrity, database consistency, and DNS cutover timing for seamless zero-downtime hosting transfers.

Following these manual migration procedures gives webmasters complete confidence when moving mission-critical web applications between cloud hosting environments.

About the author

Blog

DevOps architect and Linux sysadmin specializing in server hardening, OpenLiteSpeed performance optimization, and free cloud hosting infrastructure.

Leave a Comment