Migration plugins often time out or run out of memory once a WordPress site grows to several gigabytes. To migrate a large WordPress site to Hostinger reliably, copy the files with rsync over SSH and move the database with WP-CLI. By the end of this guide the site runs on Hostinger and you have tested it before switching DNS.
Quick answer: Skip the browser entirely: export the database with WP-CLI, copy wp-content with rsync over SSH, then rebuild WordPress on Hostinger and import the dump.
- Enable SSH in hPanel and test the connection on port 65002.
- On the old server, run
wp db exportand save the dump outside the web root. - Copy
wp-contentand the dump to Hostinger withrsync. - On Hostinger, download WordPress core, create a database in hPanel and generate
wp-config.php. - Import the dump, run
wp search-replaceif the URL changes, and flush caches. - Test through your hosts file, then update DNS.
In this guide
- Before You Start
- Step 1: Enable SSH on Hostinger and Test the Connection
- Step 2: Export the Database on the Old Server
- Step 3: Copy wp-content to Hostinger with rsync
- Step 4: Set Up WordPress Core and wp-config.php on Hostinger
- Step 5: Import the Database
- Step 6: Update URLs and Paths with search-replace
- Step 7: Fix File Permissions
- Step 8: Test the Site Before Switching DNS
- If Something Goes Wrong
- Frequently Asked Questions
- Next Steps
Working on the command line avoids the PHP timeouts that break plugin migrations, keeps file permissions intact, and can resume if the connection drops.

Before You Start
- Hostinger plan: SSH access is included on Hostinger’s Premium, Business and Cloud plans (not on the entry-level Single plan).
- Old server: SSH access with WP-CLI and
rsyncinstalled, and permission to connect out to another server. If the old host has no SSH, download the database dump andwp-contentwith its backup tool or SFTP, and run the rsync commands from your own computer instead. - Time: about an hour for the steps themselves. The file transfer for a multi-gigabyte site can take much longer, depending on both servers’ connections.
- Safety: leave the old site running and unchanged until DNS has switched and the new site is confirmed. Install into an empty Hostinger site: Step 4 overwrites WordPress core files in
public_html.
Step 1: Enable SSH on Hostinger and Test the Connection
In hPanel, go to Advanced > SSH Access and turn SSH access on. Note your port (Hostinger uses port 65002 instead of 22), IP address and username.
Test the connection from a terminal on your own computer:
ssh -p 65002 u123456789@203.0.113.10Enter your password when asked. If it worked, you get a shell prompt that shows your Hostinger username.
While connected, check that WP-CLI works and which PHP version is active:
wp --info
php -vwp --info prints the WP-CLI version and the PHP binary it uses. Compare the php -v version with the old server. If they differ by a major version, set the same PHP version for the site in hPanel before importing. Hostinger includes WP-CLI on these plans, so nothing needs installing.
Step 2: Export the Database on the Old Server
Large databases often time out in phpMyAdmin or backup plugins. WP-CLI runs mysqldump from the shell, so web server limits don’t apply.
SSH into your old server and go to its WordPress root folder (often /var/www/html or public_html). Run wp db export piped through gzip. Write the dump to your home folder rather than the web root, so nobody can download it over HTTP:
cd /var/www/html
wp db export --add-drop-table - | gzip > ~/backup_database.sql.gzThis compresses the dump as it is written. SQL text compresses very well, which makes the transfer much faster. Check that the file exists and isn’t empty with ls -lh ~/backup_database.sql.gz.
Step 3: Copy wp-content to Hostinger with rsync
Don’t build huge zip archives in cPanel or wp-admin. Zipping a 20GB media library uses a lot of server resources and often times out. rsync streams the files directly from one server to the other and can resume if interrupted.
On Hostinger, your site’s root folder is usually ~/domains/yourdomain.com/public_html. Run this command on the old server to push media, themes and plugins to Hostinger:
rsync -avzP -e "ssh -p 65002" --exclude '/cache/' --exclude '/backup*/' --exclude '*.log' /var/www/html/wp-content/ u123456789@203.0.113.10:~/domains/yourdomain.com/public_html/wp-content/What the options do:
- -a (archive): keeps timestamps, symlinks and file permissions.
- -v (verbose): lists each file as it transfers.
- -z (compress): compresses data on the way over the network.
- -P (progress and partial): shows progress and keeps partly transferred files, so a rerun resumes instead of starting over.
- –exclude: skips log files, the
wp-content/cachefolder and old backup folders. The leading slash ties a pattern towp-contentitself, so plugin subfolders that happen to be namedcacheare still copied.
When it finishes, rsync prints a summary with the bytes sent and the total size. Then copy the database dump from Step 2, also from the old server:
rsync -avzP -e "ssh -p 65002" ~/backup_database.sql.gz u123456789@203.0.113.10:~/Step 4: Set Up WordPress Core and wp-config.php on Hostinger
With wp-content on Hostinger, you now need clean WordPress core files and an empty database.
In your Hostinger SSH session, go to the site root and download core without the default themes and plugins:
cd ~/domains/yourdomain.com/public_html
wp core download --skip-content --forceNext, create a new MySQL database and user in the Databases section of hPanel. Note the database name, username and password.
Back in SSH, generate wp-config.php with WP-CLI. The --prompt=dbpass option asks for the password interactively, so it doesn’t end up in your shell history:
wp config create --dbname="u123456789_dbname" --dbuser="u123456789_dbuser" --dbhost="localhost" --dbprefix="wp_" --prompt=dbpassMake sure --dbprefix matches the table prefix your old site used. You can find it as $table_prefix in the old wp-config.php. Each command ends with a WP-CLI “Success” line when it works.
Step 5: Import the Database
Still in the Hostinger SSH session, inside the site root, import the compressed dump:
gzip -dc ~/backup_database.sql.gz | wp db import -This streams the decompressed SQL straight into MySQL without unpacking a giant file onto disk first. Large databases can take several minutes, so let it run. Then run wp option get siteurl: it should print your site’s address, which confirms WordPress can read the imported tables.
Once that works, delete the dump on Hostinger (and the copy on the old server too):
rm ~/backup_database.sql.gzStep 6: Update URLs and Paths with search-replace
If the domain stays the same, you can usually skip the URL replacement and just flush caches. If you’re moving from a staging domain or temporary URL, you must update the URLs in the database.
Don’t use raw SQL such as UPDATE wp_options SET option_value = ... to change domain names. WordPress stores widgets, theme settings and page builder data as serialized PHP arrays, which record the length of each string. Raw SQL changes the text but not the lengths, which breaks those settings.
Use the WP-CLI search-replace command, which unpacks serialized data, swaps the text and repacks it safely. Start with a dry run, which changes nothing:
wp search-replace "https://old-domain.com" "https://new-domain.com" --all-tables --precise --dry-runThe dry run prints a table of database tables and columns with a replacement count for each. If the numbers look right, run it again without --dry-run:
wp search-replace "https://old-domain.com" "https://new-domain.com" --all-tables --preciseFor edge cases, such as the guid column and Elementor’s escaped URLs, see how to safely update URLs after a WordPress migration with WP-CLI.
After updating the database, flush the object cache and rewrite rules:
wp cache flush
wp rewrite flush --hardStep 7: Fix File Permissions
Permission differences between hosts often cause “Unable to create directory” errors when you upload media in /wp-admin.
In your Hostinger SSH session, reset folder and file permissions:
cd ~/domains/yourdomain.com/public_html
find . -type d -exec chmod 755 {} +
find . -type f -exec chmod 644 {} +
chmod 600 wp-config.phpThis keeps wp-config.php readable only by your account while leaving the uploads folder writable by PHP. The commands print nothing when they succeed.
Step 8: Test the Site Before Switching DNS
Before you change DNS at your registrar, test the migrated site by pointing only your own computer at Hostinger through its hosts file.
On macOS or Linux, open /etc/hosts in a terminal on your computer:
sudo nano /etc/hostsOn Windows, open Notepad as Administrator and edit C:\Windows\System32\drivers\etc\hosts. Add your Hostinger IP address and domain name at the end:
203.0.113.10 yourdomain.com
203.0.113.10 www.yourdomain.comSave the file. Run ping yourdomain.com: it should now show the Hostinger IP. Load https://yourdomain.com in a private browser window. Expect a certificate warning if the SSL certificate hasn’t been issued on Hostinger yet. Log in to wp-admin, upload a test image, run a test checkout if you use WooCommerce, and check that your key pages render.
Once everything checks out, remove the test lines from your hosts file and update your DNS A record at your registrar. If your domain is registered with Namecheap, follow the guide to point Namecheap DNS to Hostinger without breaking email.
If Something Goes Wrong
- “Permission denied” when connecting or running rsync: check the username, IP and port
65002from hPanel’s SSH Access page, and that SSH is switched on. - “Error establishing a database connection” after the import: the database name, user, password or prefix in
wp-config.phpdoesn’t match. See how to fix “Error establishing a database connection” on Hostinger. - The import stops with an error about an unknown collation: the old database server used a collation the new one doesn’t support. The guide to import a large WordPress database over SSH shows how to replace the collation in the dump before importing.
- The site redirects to the old domain: the URLs weren’t replaced. Run Step 6, then flush caches.
- Images are missing: check that
~/domains/yourdomain.com/public_html/wp-content/uploadsexists. A missing trailing slash on the rsync source path creates a nestedwp-content/wp-contentfolder instead.
Frequently Asked Questions
Why use WP-CLI instead of a plugin like All-in-One WP Migration?
Because plugins run inside the PHP web process, which is bound by max_execution_time and memory_limit. On large databases or media folders, web-based tools often stop halfway. SSH and WP-CLI run in the shell, where those web timeouts don’t apply, and rsync can resume a broken transfer.
What should I do if my SSH connection drops during rsync?
Run the exact same rsync command again. Because it uses the -P (partial and progress) option, rsync compares both folders, skips files that already match and continues with the rest. Partly transferred files are resumed instead of starting from zero.
How do I handle a multisite network with search-replace?
Add the --network option to the wp search-replace command so it covers every site’s tables. Read the WordPress Multisite Network documentation first, because the network tables (such as wp_blogs and wp_site) store domains that need careful handling.
Will wp core download --skip-content overwrite my wp-content folder?
No. The --skip-content option downloads only the core folders (wp-admin, wp-includes and the root files) without the default themes and plugins. Your transferred wp-content folder stays intact, even with --force.
Next Steps
After DNS points to Hostinger, check that the SSL certificate is active and the site loads without warnings. Keep the old server for a few days in case something was missed, then delete the database dump and cancel the old hosting. Set up regular backups on the new host before you make further changes.

