How to Migrate a WordPress Site to a New Host or Domain

Build and Manage Your Website on HubSpot's Content Hub
Jamie Juviler
Jamie Juviler

Published:

Hopefully, you're happy with where your WordPress website sits on the internet right now. But if you're dissatisfied with your hosting provider or domain, you'll need to figure out how to migrate WordPress site to another without disruption.

migrate wordpress: Image shows a hand with a pen and a laptop

Learn More About HubSpot's CMS Software

Luckily, you don't need to learn how to migrate a WordPress site alone. In this post, we'll walk you through a few reasons people may move WordPress site to a new host or domain, and share how to do so.

Why transfer WordPress site to a new host or domain?

There are two main reasons why you decide to transfer WordPress site to a new host or domain. Maybe you purchased a more authoritative domain, or you'd like to rebrand with a new name or URL.

Alternatively, maybe your hosting provider isn't up to par, or you've found additional money in your budget for an upgrade. Whatever your reason for learning how to migrate a WordPress site may be, it will ultimately help your business establish a solid online presence in the long run.

As a site administrator, you may feel intimidated by all of this. Don't worry — this guide is here to help you discover how a non-developer can move WordPress site to a new host or domain.

How to Migrate a WordPress Site

Ready to learn how to migrate a WordPress site? The first thing you need to know is that learning to migrate WordPress depends on if you're switching a domain name or a web host entirely.

Whether you're moving it to a new host or just switching the domain, you can use a WordPress migration plugin to help. Let's walk through how you'd use Duplicator, a free, must-have WordPress migration plugin, to switch your domain. It scores major points because it's free to use, handles most of the transfer work for you, saves you time, and reduces the likelihood of an error.

Your primary goal when learning how to migrate a WordPress site to a new domain is to minimize the negative impact on search engine optimization (SEO) and site traffic. Heads up: You should expect at least a minor drop in both of these. This is because search engines and users take a minute to learn about the new site address. However, when you do migrate the domain properly and cautiously, your website will draw more visitors than ever before. Here's how you can do it.

1. Back Up Your Website Files

Don't proceed with any other steps to transfer WordPress site to a new domain before you first complete this. Backing up your WordPress site is necessary because you will upload it to your new domain. Plus, a backup offers significantly less data loss in case there's an accident with the transfer.

To recap, completing a full backup will involve downloading all of your website files onto a local drive. This will include a database (that contains your website content and data in entirety) and static files (such as your WordPress core and theme files). To complete a fully functional website, these files need each other.

You're in luck: The Duplicator plugin can help you seamlessly back up your files. Here's how.

To back up your files with your Duplicator plugin:

1. Install and activate the Duplicator plugin by choosing Plugins > Add New from your WordPress dashboard.

2. Once activated, you’ll see a new Duplicator option in your WordPress dashboard panel. Select Duplicator > Packages.

3. In the Packages » All screen, click Create New.

4. Give your new backup a name, then click Next.

migrate wordpress website: the name backup window in the WordPress migration plugin Duplicator

5. After Duplicator completes a site scan, click Build. This will take some time depending on the size of your site.

6. Once the backup file is built, select the One-Click Download option. This downloads both your backup file and the installer.php file to your device. installer.php will be used to restore your backup to your new domain.

Once downloaded, copy your backup file and store it in a safe spot. If something goes wrong and you need to restore it, you'll be all set.

2. Create a Database for Your New Domain

Now, we need a database linked to the new domain. That's where you will upload the WP site files. If there's already a database set up with your new domain, skip this step.

The easiest way to create a database is using cPanel, which comes included with most hosting providers.

To create a new database with cPanel:

1. Log into your hosting account and navigate to the cPanel main menu.

2. Under Databases, select MySQL Databases.

migrate wordpress website: the database selection window in cPanel

Image Source

3. Under Create a New Database, enter a name for the database and click Create Database. Save this name for later.

4. Add yourself as a user to modify the database. Under Add a New User, enter a username and password, then click Create a User. Save these credentials for later.

migrate wordpress: the add user window in cPanel

Image Source

5. Scroll down to Add a User to a Database, choose the user and database you just created from the dropdowns, then click Add.

6. On the Manage User Privileges screen, check the ALL PRIVILEGES box to give yourself full access to the database, then click Make Changes.

3. Upload Backup Files to the New Database

In this step, we'll populate the new database with your WordPress website files, using both tools (cPanel and Duplicator).

To upload your files to your new database:

1. Under Files, select File Manager.

2. In the File Manager Directory Selection window, select the option Document root for and choose your new domain from the dropdown, then click Go.

migrate wordpress site: image shows the step you have to take to migrate your site

Image Source

3. Select Upload from the top toolbar to upload your site backup file and installer file.

4. Go to domain.com/installer.php, where “domain.com” is your new domain name. You’ll see the duplicator installation wizard, thanks to the installer.php file. Click Next.

5. Enter the name of the database you created for the file upload, then your username and password to access the database. Click Next.

migrate wordpress site: image shows the next step of how you would migrate your site to a new platform

Image Source

6. On the next screen, Duplicator will automatically fill in the URL field with your new domain. Click Next.

7. On the final screen, click Save Permalinks, then Test Site to review your site in its new location.

migrate wordpress website: discover the next step in the site migration process

Image Source

4. Redirect Your Old Site to Your New Site

The heavy lifting is done: You've placed your files in your new domain. But what about your old website domain? If it still points to your old site, visitors and search engines won't know how to access your new domain, which hurts your SEO.

The solution is to make your old domain send users to your new domain with permanent 301 redirects so visitors land on your new domain after typing the old one into their browser. To work properly, every page on your old site should redirect to its new counterpart.

To redirect your old WordPress site to your new site, you can use one of many redirect plugin options to handle the coding for you. Alternatively, you can quickly take care of 301 redirects with a bit of light coding. Log into the backend of your old WordPress site and add the following code to the top of the .htaccess file, stored in your root directory:

 

#Options +FollowSymLinks

RewriteEngine on

RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]

where newdomain.com is your new domain name. Lastly, save the file.

To test your redirects, enter your old website URL into your browser. All URLs using your old domain, including all subdirectories and slugs, should redirect to your new domain. If redirects aren't working, contact your hosting support.

5. Clean Up Your New WordPress Site

Though your site might appear to be working in your new domain, there are likely some small bugs left over from the switch that you'll need to address. First, find and fix any broken links on your new website resulting from the domain change.

Next, change all internal links to your new domain. Otherwise, these links will just send people back to your old domain. We recommend using a plugin like Better Search Replace to track down these faulty links and update them quickly.

Finally, complete a manual sweep of your entire site. Review every page, plugin, and site setting to ensure your site looks and works as intended. If you find that images or other media aren't showing, you can either replace them manually or use your find-and-replace plugin to make all image links refer to your new domain.

6. Update Your Visitors and Google About Your New Domain

Your website is ready on the new domain. Congratulations!

But before telling all your friends and family, we recommend telling Google about your recent change. This step is important for showing your new website on Google results pages.

You can update Google through Google Search Console, a free tool for optimizing your website's organic search presence. See Google's guide to the Change of Address tool to optimize your new domain with Google Search Console.

Finally, don't forget about your visitors! While 301 redirects will channel all traffic to the right place, you might want to inform your users of the domain change personally. You can do this with an email to subscribers, a front-page message, a blog post, and/or a social media post. Now you're all ready to celebrate the new domain name.

The process of moving from one host to another is similar to switching domains, but there are some important differences. Here's how to switch hosting providers for your WordPress site:

1. Set Up Your New Hosting Account

First, find a new hosting provider that better suits your needs. For help searching, see our list of the best WordPress hosting providers.

Many hosts offer migration assistance free of charge. This service can make the transition much easier, so take this option into account when browsing alternatives.

2. Back Up Your Website Files

Download your current WordPress site files onto your device in order to re-upload them to your new host. You can also reinstall your backup and try again if an accident occurs. Once again, you'll make use of the Duplicator plugin.

To back up your files with the Duplicator plugin:

1. Install and activate the Duplicator plugin by choosing Plugins > Add New from your WordPress dashboard.

2. Once activated, you’ll see a new Duplicator option in your WordPress dashboard panel. Select Duplicator > Packages.

3. In the Packages » All screen, click Create New.

4. Give your new backup a name, then click Next.

5. After Duplicator completes a site scan, click Build. This will take some time depending on the size of your site.

6. Once the backup file is built, select the One-Click Download option. This downloads both your backup file and the installer.php file to your device. installer.php will be used to restore your backup to your new host.

Make a copy of your backup file and store it safely throughout the rest of the migration.

3. Transfer Your Website Files to the New Host

For this step, you have two options. If your hosting provider offers migration service, follow their instructions and then move on to the next step.

If your host does not offer this service, you must create a database on your new hosting server to place your WordPress files. This is most easily done with cPanel, available with the most popular hosting providers. Then, Duplicator will handle the rest of the transfer for you.

To place your website files on your new host server:

1. Log into your hosting account and navigate to the cPanel main menu.

2. Under Databases, select MySQL Databases.

3. Under Create a New Database, enter a name for the database and click Create Database. Save this name for later.

4. Add yourself as a user to modify the database. Under Add a New User, enter a username and password, then click Create a User. Save these credentials for later.

5. Scroll down to Add a User to a Database, choose the user and database you just created from the dropdowns, then click Add.

6. On the Manage User Privileges screen, check the ALL PRIVILEGES box to give yourself full access to the database, then click Make Changes.

7. With a database set up, you can upload your WordPress backup files. In cPanel, upload your site backup file and installer file to your root directory.

8. Go to domain.com/installer.php, where “domain.com” is your domain name. You’ll see the duplicator installation wizard.

9. Enter your database name, then your username and password that you just created (Host can stay as “localhost”).

10. Click Test Connection. If the test runs properly, you’ll see the following:

migrate wordpress site: the test connection window in Duplicator, a WordPress migration plugin

Image Source

11. Click Run Deployment.

12. The next screen will show your old and new URLs, which should be the same if you’re keeping your old domain. Click Run Update.

13. On the final page, follow the testing suggestions if you’d like.

4. Point Your Domain to Your New Host

You've successfully recreated your website on a new host. But now, it's time to change your domain name to direct users to your new website location. Otherwise, you'll face difficulty because the URL will send visitors to your old website.

Your host will give you at least two nameservers that connect your domain name to the server where your content is hosted. Most hosts provide these in an accessible place in your account.

After acquiring your nameservers, log into your domain registrar and replace the nameservers of your old host with those from your new host. You'll need to wait anywhere from a few hours to a couple of days for your domain to point to your new site for all users.

5. Check Your New Site

Visitors should notice no changes to your website while you switch hosts — after all, the content itself hasn't changed, only where it's stored. Even better, assuming no major issues with the transfer, your site will experience zero downtime during the migration.

That said, it's good practice to check as many pages as you can to ensure all content is transferred properly and replace any missing files or content if needed. (Remember your backup?)

Don't Fear the Transfer

With your migration complete, you can work to continue to build out your online presence in its new home. All it took was an hour or two of your time and a handy plugin.

You might even consider making a WordPress staging site, now that you're a site-migration whiz. A staging site is a hidden copy of your public-facing website you can use to test out changes and updates. Moving content from your test domain to your official domain should now be a breeze.

Editor's note: This post was originally published in June 2020 and has been updated for comprehensiveness.

Discover videos, templates, tips, and other resources dedicated to helping you  launch an effective video marketing strategy. 

 

Related Articles

Pop up for BUILD AND MANAGE YOUR WEBSITE ON HUBSPOT'S CONTENT HUB HUBSPOT'S CMS SOFTWARE

Build and Manage Your Website on HubSpot's CMS Hub

LEARN MORE
Pop up for BUILD AND MANAGE YOUR WEBSITE ON HUBSPOT'S CONTENT HUB HUBSPOT'S CMS SOFTWARE

CMS Hub is flexible for marketers, powerful for developers, and gives customers a personalized, secure experience

START FREE OR GET A DEMO