Backups and migrations
How to migrate WordPress to another hosting without losing data
Migrating WordPress to another hosting means copying its files and database, adapting the configuration and checking the website before pointing the domain to the new server. Changing only the DNS does not copy the installation.
If you are moving more than WordPress, such as email, subdomains or several applications, start with the general guide to migrating a hosting account.
What you need to copy
A WordPress installation needs:
- All the files in the website's directory, including
.htaccess. - The
wp-contentfolder, with themes, plugins and uploaded files. - The complete database.
- The connection details stored in
wp-config.php. - Scheduled tasks outside WordPress, if there are any.
- Special rules, redirects or server configuration.
The domain's email is not part of WordPress. If it is also changing provider, follow the route for migrating mailboxes without losing messages.
Before starting the migration
Check:
- The space used by files and database.
- The WordPress, PHP and MySQL or MariaDB versions.
- The PHP extensions and memory limits needed.
- Whether the website uses a shop, bookings, forms or content that changes often.
- Caching, security or licensing plugins, or services tied to the domain or IP address.
- Who manages the DNS and how long the previous hosting will stay active.
Create a recoverable backup before changing anything. Do not use the move to update WordPress, PHP, the theme and all the plugins at the same time: keeping the migration separate from updates makes it easier to pin down any fault.
Choose the migration method
Automatic migration with Softaculous
If the remote installation is accessible and you can connect over FTP, Softaculous can import WordPress, copy the database and adapt the new path. See how to migrate an application from a remote server.
It is a convenient option for ordinary installations. It can fail when the source limits execution time, blocks the helper process or contains a website that is too large.
Migration plugin
Backup or cloning plugins package the installation from the WordPress dashboard. Before choosing one, confirm:
- The destination's maximum upload limit.
- The maximum size supported by the free version or licence you use.
- That the package really includes files and database.
- That there is space for the package and the restored copy at the same time.
Do not leave the migration file downloadable from the web when you finish.
Manual migration
It is the method that gives you most control when the automatic copy fails:
- Download or package all the files from the source.
- Export the database as SQL or compressed SQL.
- On the destination, create a database and a user with all the necessary privileges on it.
- Upload the files to the right document root.
- Import the database.
- Update
DB_NAME,DB_USER,DB_PASSWORDandDB_HOSTinwp-config.php.
You can use the cPanel File Manager, FTP and phpMyAdmin for these steps.
If the domain or URL also changes
When the website moves from one domain, subdomain or directory to another, you need to adapt the URLs stored in WordPress.
Do not run a direct text replace over the whole SQL file: WordPress and its plugins may store serialised data whose length would end up wrong. Use a tool that supports serialised data or make the change from WordPress after importing a copy.
During testing you can temporarily define these constants in wp-config.php. If they already exist, change their values without duplicating them. The example assumes the public address and the WordPress folder are the same; keep the subdirectory in WP_SITEURL if your installation needs it:
define('WP_HOME', 'https://www.ejemplo.com'); define('WP_SITEURL', 'https://www.ejemplo.com');
These constants take precedence over the home and siteurl values in the database and prevent them from being edited in Settings > General. If you use them only to regain access or test the migration, update the WordPress options afterwards and remove the constants; otherwise, when you remove them in the future, the old URL stored in the database will come back.
Then check links, images, menus, widgets, page builder content and redirects. If the domain does not change, you do not need to replace URLs just because the website has moved to another server.
Test WordPress before changing the DNS
Whenever possible, check the destination while the domain is still serving the previous website. You can edit your computer's hosts file following the guide to previewing the domain on another IP address.
Test at least:
- Home page, inner pages and permalinks.
- Access to
wp-adminand saving content. - Images, styles, JavaScript and fonts.
- Forms and actual delivery of their messages.
- Search, comments and users.
- Basket, orders, bookings and payments, if any, using the gateway's test mode and avoiding real charges or notifications during the check.
- File uploads and thumbnail generation.
- Cron, backups, caching and security plugins.
If 500 errors or blank screens appear, first check the PHP version, extensions, permissions and the error log. For a MySQL failure, follow the guide to fixing the database connection error in WordPress.
Synchronise the latest changes
The first copy can go out of date if the website keeps receiving orders, forms or changes. Just before the move:
- Schedule a window with little activity.
- Put the application into maintenance mode if you cannot reconcile writes on both servers.
- Copy the new files in
wp-content/uploads. - Export and import the database again, or synchronise only the data you have defined.
- Note the time of the last write included.
Do not import the whole database again after opening the destination to the public: you could delete orders or changes already created on the new server.
Decide when to turn off the scheduled tasks on the source and turn on those on the destination. Having both copies run them can duplicate emails or operations, even if only one receives visitors.
Change the DNS
When the final copy and the tests are correct, point the domain to the new hosting. If you change the DNS servers entirely, first recreate the MX, TXT, CNAME and SRV records for email and external services.
If you change the DNS servers and use DNSSEC, also coordinate the DS records with the new zone.
Follow the procedure for changing DNS with minimal downtime and keep the source active during propagation.
Checks after migrating WordPress
- Confirm through public DNS which server is responding.
- Repeat the functional tests without the local change to the
hostsfile. - Save the permalinks again if the rewrite rules do not work.
- Clear the WordPress, server, CDN and browser caches.
- Check the HTTPS certificate and mixed content.
- Check forms, the application's email, cron and backups.
- Review orders, forms and data created close to the time of the move.
- Delete packages, SQL dumps and temporary access.
Do not cancel the previous hosting until you have completed the post-migration checklist.
Free migration to Hostsuar
We can migrate your WordPress site to a Hostsuar hosting service free of charge. Tell us the current provider and panel, the domain, the space used, the PHP version and whether you also need to move email.
Do not send passwords in a ticket. If we need to access the source, we will tell you how to provide temporary credentials securely.
You may also find useful
- Change the WordPress domain or URL Choose between the dashboard, wp-config.php and phpMyAdmin to change the WordPress URL, and replace...
- Change the domain or folder of a WordPress website Tell changing the public address of WordPress apart from moving its folder, and review paths, links...
- Increase the upload limit in All-in-One WP Migration Check the effective PHP limit and the space needed to import a .wpress file, and tell upload errors...
- Publish a locally developed WordPress site on your hosting Upload files to the right directory, import the database and replace local addresses before checking...
Something wrong or out of date? Tell us and we will review it.