Migrate a WordPress site
Migrating WordPress means moving two linked objects: files and the database. The hard part is the URLs stored in the database and the DNS switch timing. Plan a quiet window and keep the old site intact until the final check.
Prepare, export and lower the TTL
Start with an inventory: WordPress and PHP versions, active plugins, database size, media footprint, certificate.
Lower the A and AAAA TTL to 300 seconds at least 24 hours before the switch. Resolvers then forget the old address in minutes instead of hours.
If you change hosting, check the available PHP version and required extensions (for example gd, curl, mbstring, intl). A missing extension causes silent errors.
Export the database as SQL in utf8mb4, and download wp-content, wp-config.php and .htaccess if it exists. Note the table prefix: it is not always wp_.
One-file migration plugins (Duplicator, All-in-One WP Migration) simplify the job, but check the target upload limit and test the archive first.
Import on NeoHeberg
- Add the domain in KeyHelp and create a MySQL database with a dedicated user.
- Upload the files to the document root over SFTP.
- Import the SQL from phpMyAdmin. If it fails, temporarily raise the execution limit or import table by table.
- Update
DB_NAME,DB_USER,DB_PASSWORDandDB_HOSTinwp-config.php. - Generate new security keys: the old database may contain sessions.
Rewrite the URLs
Absolute URLs live in the wp_options table and inside content. Use a plugin such as Better Search Replace in dry-run mode to replace https://old-domain.com with https://new-domain.com.
Mind serialized data: a plain SQL UPDATE breaks string lengths and corrupts settings. A tool that handles serialization is required. With WP-CLI on a VPS, wp search-replace with --precise and --dry-run does it safely.
Switch DNS and SSL
Before touching DNS, test the new server without changing resolution, from your machine:
curl -sI --resolve your-domain.com:443:[YOUR_IPV6] https://your-domain.com/ | head -n 5Replace YOUR_IPV6 with the real service address. If the page answers, change the A and AAAA records and wait for the TTL to expire.
Issue the Let's Encrypt certificate after the switch: HTTP validation requires the domain to point to the hosting already. Then force HTTPS and check for mixed content.
Verify and keep a rollback
- Home page, posts, media and menu display correctly.
- The admin accepts the login and permalinks work.
- Forms submit and email arrives (SMTP,
SPF,DKIM). - The certificate is valid, with no warning in the browser console.
- Redirects from the old domain, if you keep it, point to the new one.
Keep the old hosting and DNS for at least a week. Rollback means restoring the old nameservers or address, and must stay possible until everything is validated.
Common failures: a blank page usually means an incompatible plugin or a missing file. Broken media means an unreplaced URL. A login loop comes from a cookie bound to another domain: clear cookies or change the keys.
Advertisement
Was this article helpful?
Read next
- Back up WordPressFiles and database belong together: manual method, plugin, off-site copy and a tested restore.
- Optimize WordPress performanceCache, images, database and PHP 8.4: the WordPress settings that really change load time.
- Secure WordPressUpdates, accounts, configuration and plugins: reduce the attack surface without breaking the site.