How to move a WordPress site to a new domain

Moving a WordPress site to a new domain means changing its primary web address, a common step during rebranding or a strategic shift.
While it’s a necessary process, doing it incorrectly can have serious consequences, such as data loss, broken functionality, and a significant drop in your search engine rankings.
Here’s a quick look at how to move your WordPress site to a new domain:
- Secure your data. Start by creating a complete backup of your website’s files and database to prevent any data loss during the transfer.
- Copy your database. Export the entire database, which contains all your posts, pages, and user information, preparing it for the new location.
- Relocate your files. Upload the backup of your website’s core files to the server associated with your new domain name.
- Set up the new database. Create a new, empty database on your new hosting account and import the data you exported earlier.
- Update database URLs. Change the site URL references within the newly imported database to reflect your new domain name.
- Configure WordPress. Edit the wp-config.php file to connect your WordPress installation with the new database.
- Repair internal links. After the move, scan your site for any internal links still pointing to the old domain and update them.
- Redirect traffic and bots. Implement 301 redirects to automatically send visitors and search engine crawlers from your old domain to the new one.
- Inform Google. Use Google Search Console to officially notify the search engine that your site has moved to a new address.
1. Back up your WordPress website
Before migrating your WordPress site, the first and most critical step is backing up all your site’s files and its database. This gives you a complete, working version of your site that you can restore if anything goes wrong during the migration, preventing any data loss.
There are several ways to back up your WordPress site, including using a plugin or the backup tools provided by your hosting provider. The goal is to download a full copy of your site’s public_html directory and a separate file for your database.
2. Export the WordPress database
After backing up your files, you need to export the database from your old hosting account. You can typically do this using phpMyAdmin, a popular database management tool available in most hosting control panels.
The process involves selecting your database in phpMyAdmin, choosing the export function, and saving it as an SQL file. For a step-by-step guide, see our tutorial on how to export your MySQL database using phpMyAdmin.
3. Upload your WordPress files to the new domain
With your website files backed up and saved to your computer, the next step is to upload them to your new hosting account.
This will place your WordPress core files, themes, plugins, and media uploads into the root directory of your new domain, typically the public_html folder.
You can upload your website files using your new host’s File Manager or an FTP client like FileZilla. The transfer might take some time depending on the size of your website.
4. Import the database to the new hosting environment
After uploading your files, you need to import your WordPress database into the new hosting environment.
First, create a new, empty MySQL database in your new hosting account’s control panel. You’ll need to set a database name, a username, and a password – be sure to save these details for a later step.
Once the new database is ready, use phpMyAdmin in your new hosting account to import the SQL file you exported earlier. This will populate the new database with all your old site’s content.
You can find detailed instructions in our guide on how to import a database with phpMyAdmin.
5. Update the website URL in the database
Your imported database still contains URLs pointing to your old domain name. You’ll need to change these WordPress URLs in phpMyAdmin to your new domain for WordPress to work correctly.
To do so, simply locate the wp_options table of your new database, find the siteurl and home rows, and replace the old domain with the new one.
6. Update Details in wp-config.php
As the wp-config.php file is responsible for setting up WordPress database connections, you must update it to reflect the domain name change.
Locate the PHP file in your root directory and then open it using your web host’s File Manager. Replace the values of the following functions with the new ones.
define('DB_NAME', 'new database name); define('DB_USER', 'new database username'); define('DB_PASSWORD', 'new database password'); define('DB_HOST', 'new host name');
Add the following code snippet above the “MySQL settings – You can get this info from your web host” text to redefine the location of your core WordPress files. Make sure to replace the placeholder URL with the correct domain name.
define('WP_HOME', 'http://newdomain.com'); define('WP_SITEURL', 'http://newdomain.com');
Pro Tip
If you prefer to use a text editor over a File Manager, download the wp-config.php file via an FTP client and re-upload it to the root folder once you update it.
7. Fix Broken Links
Broken links are among the most common issues when moving WordPress site to a new domain. WordPress users are being redirected to 404 error pages when clicking on the links on your website, increasing the bounce rate and hurting your SEO efforts.
For these reasons, fixing any broken links on your new WordPress site is essential before it goes live.
Locate broken links on your new WordPress site using an SEO audit tool like Semrush and Google Search Console. Many WordPress plugins like Broken Link Checker and Link Checker Professional can help you fix faulty links without manually updating each page.
Pro Tip
If WordPress link checker plugins can’t solve your broken link issue, consider resetting the WordPress permalinks settings or .htaccess file.
8. Set up 301 Redirects From the Old Site
Now that your WordPress website has fully migrated to the new domain, the next step is to set up 301 redirects. Whenever users access a URL that belongs to your old domain, they’ll be redirected to the same web page on the new domain instead of a 404 error page.
Like the previous step, setting up 301 redirects from the old domain helps to maintain your SEO efforts and excellent user experience. It’s also a great way to preserve your old domain’s authority and speed up the new domain’s traffic growth.
Hostinger users can redirect their URL using the Redirects feature in hPanel. Alternatively, create 301 redirects using WordPress SEO plugins like Yoast SEO and All in One SEO.
9. Update Your Google Search Console
The next step for transferring a WordPress site to a new domain is notifying Google about your domain name change. The easier search engine crawlers can find your new domain name, the sooner your WordPress site can rank in search results.
Navigate to Settings from your Google Search Console dashboard and use the Change of Address tool to submit your request for the domain change. Keep in mind that the verification process can take up to 180 days to complete.
Pro Tip
If you wish to switch to Hostinger but don’t have time to do it manually, we have a migration team that can assist you with that, you only need to send us a request to move website.
Conclusion
Moving WordPress site to a new domain can benefit its growth only if it’s done right. Otherwise, you’ll end up with many technical issues that are time-consuming to fix and harmful to your SEO efforts.
We have gone through the nine steps to move an entire website to a new domain. Each step comes with helpful tips to ensure your SEO remains unaffected by the migration process.
Should you have any more questions, leave us a comment below.
Learn More About WordPress
What is WordPress
How to Install WordPress
What Is a Permalink in WordPress
How to Create a Contact Form in WordPress
How to Edit Footer in WordPress
How to Undo Changes in WordPress
2 Methods on Adding WordPress Menu Icons
How to Update WordPress
How to Change WordPress Domain Name
How to Duplicate Pages in WordPress
How to Move My WordPress to a New Domain FAQs
Here are some frequently asked questions about how to move your WordPress site to a new domain.
How Does Changing My Domain Affect SEO?
Changing your domain can cause a temporary drop in rankings and traffic, affect backlinks and domain authority, and require updating URLs across the site. Therefore, proper planning and implementation of redirects can help minimize negative effects.
Can I Move My WordPress Site to a New Domain for Free?
Yes, you can move your WordPress site to a new domain for free. However, you may need to pay for domain registration and hosting fees for the new domain. There are free plugins available to assist with the migration process.
All of the tutorial content on this website is subject to Hostinger's rigorous editorial standards and values.