Standard migration plugins choke the moment your WordPress site climbs past 5GB. You run straight into PHP execution timeouts, out-of-memory crashes on wp-content/uploads, and corrupted serialized strings after clumsy database find-and-replace routines.
We can skip the web server layer entirely and move massive sites directly between servers using SSH, rsync, and WP-CLI. This command-line approach avoids HTTP timeouts, keeps file permissions intact, and finishes in a fraction of the time.

Prerequisites and Environment Verification
Before moving any data, make sure SSH access is enabled on both your source server and your target Hostinger plan. Hostinger supports SSH across its Business and Cloud tiers through hPanel.
Head into your Hostinger hPanel dashboard, go to Advanced > SSH Access, and toggle SSH access on. Take note of your port (Hostinger uses custom port 65002 instead of 22), IP address, and username.
Test the connection from your local terminal to make sure you can get in:
ssh -p 65002 u123456789@195.154.122.45Once you’re in, verify that WP-CLI works and check the active PHP version:
wp --info
php -vHostinger includes WP-CLI out of the box. If you ever hit memory caps during heavy CLI commands, you can increase PHP memory limit in WordPress on Hostinger by tuning your CLI PHP settings.
Step 1: Export the Database via WP-CLI on the Source Server
Dumping a database through phpMyAdmin or standard backup plugins regularly drops connections on tables over 500MB. Running native MySQL dumps through WP-CLI avoids web server limits completely.
SSH into your source server, navigate to your WordPress root directory (usually /var/www/html or public_html), and run wp db export piped through gzip:
cd /var/www/html
wp db export --add-drop-table - | gzip > backup_database.sql.gzThis runs mysqldump directly and compresses the stream on the fly. A 2GB raw SQL file usually drops to roughly 250MB, making network transfer much faster.
Step 2: Sync wp-content Files Using rsync
Don’t try creating huge zip archives inside cPanel or wp-admin. Zipping a 20GB media library burns server resources and almost always times out. Use rsync to stream files directly between both servers.
On Hostinger, your site’s root directory is typically under ~/domains/yourdomain.com/public_html. Run this rsync command from your source server to push media, themes, and plugins straight to Hostinger:
rsync -avzP -e "ssh -p 65002" /var/www/html/wp-content/ u123456789@195.154.122.45:~/domains/yourdomain.com/public_html/wp-content/ --exclude 'cache' --exclude 'backup*' --exclude '*.log'Here’s what these flags are doing:
- -a (archive): Preserves timestamps, symlinks, and file ownership permissions.
- -v (verbose): Streams transfer progress in your terminal.
- -z (compress): Compresses data packets while transferring over the network.
- -P (progress & partial): Keeps partial files so you can resume interrupted transfers without starting over.
- –exclude: Leaves behind log files, cache dumps, and old backup archives you don’t need.
Next, copy over the database export you created in Step 1:
rsync -avzP -e "ssh -p 65002" /var/www/html/backup_database.sql.gz u123456789@195.154.122.45:~/domains/yourdomain.com/public_html/Step 3: Prepare Core Files and Database Credentials on Hostinger
Now that your wp-content folder is sitting on Hostinger, you need clean WordPress core files and an empty database ready to receive your data.
Open your Hostinger terminal session and navigate to the target site root:
cd ~/domains/yourdomain.com/public_html
wp core download --skip-content --forceNext, create a new MySQL database and user inside Hostinger hPanel under Databases > MySQL Databases. Save the database name, username, and password.
Generate a fresh wp-config.php file using WP-CLI:
wp config create --dbname="u123456789_dbname" --dbuser="u123456789_dbuser" --dbpass="YourStrongDatabasePasswordHere" --dbhost="localhost" --dbprefix="wp_"Double-check that your --dbprefix matches whatever prefix your source site used (check your exported SQL dump if you’re not sure).
Step 4: Import the Database on Hostinger
Now import your gzipped database archive using WP-CLI. Run this in your Hostinger terminal:
gzip -dc backup_database.sql.gz | wp db import -This streams the decompressed SQL straight into MySQL through WP-CLI without needing to unpack a giant SQL file onto the disk first. Even an 800MB compressed database usually imports in under a minute.
Once it finishes, clean up the SQL archive immediately:
rm backup_database.sql.gzStep 5: Run Search-Replace for URLs and Paths
If your domain name isn’t changing, you’ll mostly just need to clear cache and update file paths. If you’re moving from a staging domain or temporary URL, you must update the URLs across your tables.
Never run raw SQL queries (like UPDATE wp_options SET option_value = ...) to update domain names. WordPress stores widgets, theme settings, and page builder data in serialized PHP arrays. Raw SQL breaks serialization strings and destroys site layouts.
Use the WP-CLI search-replace command, which safely deserializes, swaps strings, and reserializes data:
wp search-replace "https://old-domain.com" "https://new-domain.com" --all-tables --precise --dry-runCheck the dry run output. If the number of replacements looks right, rerun the command without --dry-run:
wp search-replace "https://old-domain.com" "https://new-domain.com" --all-tables --preciseAfter updating the database, flush your rewrite rules and object cache:
wp cache flush
wp rewrite flush --hardStep 6: Fix Permissions and Upload Ownership
Permission mismatches between different Linux hosts often trigger “Unable to create directory” errors when uploading media in /wp-admin.
Reset directory and file permissions across your Hostinger account:
cd ~/domains/yourdomain.com/public_html
find . -type d -exec chmod 755 {} ;
find . -type f -exec chmod 644 {} ;
chmod 600 wp-config.phpThis locks down wp-config.php from being read by unauthorized system users while keeping your uploads folder writable by the PHP fastcgi process.
Step 7: Test Locally Before Switching DNS
Before modifying live DNS records at your registrar, test the migrated site on Hostinger by adding a local entry to your hosts file.
On macOS or Linux, edit /etc/hosts with sudo:
sudo nano /etc/hostsOn Windows, open Notepad as Administrator and edit C:WindowsSystem32driversetchosts. Add your Hostinger IP address and domain name at the end:
195.154.122.45 yourdomain.com
195.154.122.45 www.yourdomain.comSave the file and load https://yourdomain.com in an incognito browser window. Log into wp-admin, run a test checkout if you’re using WooCommerce, and check that custom post types render properly.
If you’re running standalone scripts alongside WordPress, see our guide on how to install CodeCanyon PHP scripts on shared hosting to keep those directories working.
Once everything checks out, update your DNS A record at your registrar. If your domain is hosted with Namecheap, follow our guide to point Namecheap DNS to Hostinger without breaking email.
Frequently Asked Questions
Why use WP-CLI instead of plugins like All-in-One WP Migration?
Plugins execute through the PHP web process, which is bound by max_execution_time and memory_limit settings. On databases over 1GB or media folders over 10GB, web-based tools frequently crash midway through unzipping. SSH and WP-CLI run in the shell without HTTP timeout limits.
What should I do if my SSH connection drops during rsync?
Because we use the -P (partial and progress) flag, you can re-run the exact same rsync command. It scans both source and destination folders, ignores files that already match, and resumes right where the network dropped.
How do I handle multisite networks with WP-CLI search-replace?
When migrating a WordPress Multisite install, add the --network flag to the wp search-replace command. Check out the WordPress Multisite Network documentation before running global replacements, since network domain tables (like wp_blogs and wp_site) require precise handling.
Will running `wp core download –skip-content` overwrite my existing wp-content folder?
No. The --skip-content flag tells WP-CLI to download only core WordPress directories (wp-admin, wp-includes, and root files) without generating default themes or plugins in wp-content, keeping your transferred files intact.
Next Steps
Now that your WordPress database is imported and files are in place, make sure your frontend assets load quickly. If you run multiple subdomains or microservices, check out how to route subdomains to different servers in Namecheap DNS or configure caching at the edge to keep server load low.

