Guide on Moving WordPress Site To New Domain
Bulletproof Backups for Your WordPress Website
Fortify your business continuity with foolproof WordPress backups. No data loss, no downtime — just secure, seamless operation.
So, you’ve decided to move WordPress site to new domain. Whatever your reason may be, It can be overwhelming to transfer WordPress site to new domain name, and there’s a chance that things could go seriously wrong. You could lose content in the process or your entire site may break.
But fear not, as in this article, I’ll show you how to copy WordPress site to another domain name in simple, easy steps safely and without losing your SEO rankings.
TL;DR: Migrate WordPresss site to new domain using Migrate Guru, a free WordPress migration plugin that will get the job done flawlessly and with minimal input from you.
What you need to know before you start:
When changing to a new domain name, you could either:
- Stay with the same web host, or
- Change your web host along with the domain name.
The steps are mostly the same, with one major difference. If you want to move to a new web host or to a different server within the same web host, you’ll need to move your entire website, i.e., both the files and the database. If you want to change the domain name but not the server or the web host, then you only have to make a few changes to certain files and some other things that I’ll talk about in this article.
What to do before you move a WordPress site to a new domain
As I alluded to earlier, moving to another domain name can be intimidating, and things could go wrong. To make sure the process goes as smoothly as possible, you need to take care of some things before you start. If you only wish to change your domain name, then do the following:
- Purchase a new domain name from either a domain registrar or your web host. You would need to add it to your existing web host or the new one you’re switching to.
- Take a backup of your entire website, either manually or via a plugin like BlogVault. If something were to go wrong like your website crashing, for example, you’d be able to restore it.
- Prevent every user but yourself from accessing your site. It will ensure that nobody makes any changes to the site during migration, which may cause errors. You can do this easily with a maintenance plugin like Themeisle’s WP Maintenance Mode & Coming Soon. Only users with admin rights will have full access to the site, so make sure to temporarily deprive others of admin rights.
If you’re changing your domain name along with migrating to a different server or host, then you also need to do the following:
- Keep the FTP/SFTP credentials of your current and destination servers handy. You can find them on your web hosting service’s user dashboard. If you need step-by-step instructions, check out our article on how to use FTP.
- Install WordPress on your destination web hosting server. Most web hosts will automatically install WordPress for you when you sign up with them. If you’re moving to a dedicated server for your website, you may have to install it yourself.
- Disable any caching, firewall, or redirect plugins as these may cause errors during migration. You can reenable them once your site is up and running on the new domain.
- Ensure the PHP versions of both the source and destination WordPress installations are the same. If they’re not, an HTTP 500 error may occur during migration.
For a more detailed description of the stuff that you need to do before a migration (and afterward too), read our article covering a comprehensive migration checklist.
Migrate WordPress site to new domain using a plugin
There are three main ways to transfer WordPress website from one domain to another: using a migration plugin, via your web host, or doing it yourself, in increasing order of complexity.
Let’s start with the simplest, namely, using a plugin. We’ll cover how to do so using Migrate Guru, one of the best plugins for the job. It can migrate your WordPress site to a new domain on the same web host, or to a different one, flawlessly and absolutely free of charge.
Moreover, it can handle migrations for all sorts of sites, including WooCommerce sites, multimedia-rich sites with a lot of videos and/or podcasts, and multisites containing a lot of subsites. Migrate Guru just works!
- Install and activate Migrate Guru on your existing WordPress website.
- Enter your email address to create an account, and then click on Migrate Site.
- You’ll be taken to your Migrate Guru dashboard where you’ll be asked to pick the host you want to migrate to. If your destination host isn’t listed, choose either cPanel or FTP to continue.
- On the next page, enter your details and click Migrate to continue. We’ll be moving our site from Bluehost to Kinsta.
- That’s it! However, there are still some things that you need to do after the process is complete. For a complete list of the things you need to do, read our comprehensive guide on migrating a WordPress site.
Why using a migration plugin is the best option
Using a WordPress migration plugin is the best way to migrate WordPress site to another domain since the process is simple, easy, and fast. There is little to no effort required from you. Such plugins have been refined over the years and are battle-tested, meaning it’s highly unlikely that something could go wrong. As we mentioned in the introduction to this section, we highly recommend Migrate Guru since it’s effective, free, and just works.
Move WordPress site to new domain manually
If you’re the type of person who likes to be in control or likes to do things on their own, then consider moving WordPress site to new domain manually by yourself. But note that doing it yourself is a risky process, especially if you aren’t tech-savvy or don’t know what you’re doing. Having said that, if you follow our detailed step-by-step instructions, you’ll have your site up and running at your new domain in no time. We’ll be moving our site from https://wordpress-673878-2708473.cloudwaysapps.com to https://mybhsite.com.
Move your WordPress site to another domain:
- Back up your existing WordPress files
- Export your WordPress database
- Upload your WordPress files to your new domain
- Import Your WordPress database
- Make changes to your database to reflect your new domain name
- Edit the wp-config.php file
- Run a search-and-replace operation on your new database
- Set up redirects on your old site
1. Back up your existing WordPress files
Should anything go wrong, you can quickly restore your site if you have a backup of all its files. We’ll be using FTP to back up the WordPress files of our test site. FTP (File Transfer Protocol) is a network protocol (basically, a set of rules that governs how a particular thing should be done over the Internet) for the transfer of files between computers over the Internet. We’ll be connecting to our site’s server via an FTP client and then download the root folder of our WordPress installation to our hard disk. It will serve as the backup of the required files.
- Download and install an FTP client. We’ll be using FileZilla for this article.
- Open FileZilla and enter your FTP credentials at the top. Use 22 as the port number to connect via SFTP (a secure version of FTP) if your web host supports it. Click Quickconnect to connect to the server.
- A popup will appear with the message that the server’s host key is unknown. Check the box to always trust the host and click OK.
- If the connection is successful, you’ll see a confirmation in the messages area below the part where you filled in your FTP credentials, and a directory listing of your site will appear in the right-hand area labeled “Remote site.” (In an FTP connection, your computer is called the local host/site while the other machine, which is usually a server, is called the remote host/site).
- Next, navigate to the directory on your computer where you’d like to back up your WordPress files from the left-hand area labeled “Local site.” Then, locate the directory where WordPress is installed on your site from the right-hand area, which is usually public_html. Right-click on it and download it to your chosen directory on your hard disk.
2. Export your WordPress database
You don’t need to export your database if you’re staying with the same web host. However, we still recommend doing it as it creates a backup of your database, which is always helpful.
We’ll be using the free program phpMyAdmin for this step. phpMyAdmin allows site owners to manage their MySQL databases using a web-based user interface. Most web hosts will automatically install phpMyAdmin alongside WordPress when you sign up. We’ll be using Cloudways, but the steps are essentially the same for all hosts. If your web host didn’t install phpMyAdmin when you signed up, then you’ll have to install it yourself on the server. Look up the instructions for your particular web host online.
- To access your phpMyAdmin dashboard, go to the URL that you get by appending /phpmyadmin to the end of your website’s URL. You will see the following:
- Log in to your phpMyAdmin dashboard using the credentials provided by your web host.
- Once logged in, select your database from the left and click on Export to start exporting it.
- On the next screen, click Quick under Export method.
phpMyAdmin will now download your database as a zip archive. Make sure to select SQL as your format, as this is the most widely used database language.
Additional Resource: How to backup a WordPress database
3. Upload your WordPress files to your new domain
We’ll be using the same Bluehost example that we used in the previous section.
- Connect to your website via FTP. We’ll be using FileZilla for this step.
- Once connected, click on the public_html folder on the remote site, then right-click on the public_html folder on your backed-up site to upload it to your new domain.
4. Import Your WordPress database
First, create a new database on your new site. Bluehost allows you to do this via cPanel, a control panel for managing your website. If your host doesn’t have cPanel, then you’ll have to use phpMyAdmin directly. The steps are almost identical.
- In cPanel, navigate to Databases > mySQL Databases. Here, create a new database.
- Return to the aforementioned page and scroll down to the section MySQL Users to add a new user to this database. Make a note of these details, you’ll need them in a short while.
- Next, go to Databases in phpMyAdmin. Select the new database you just created and select Import. Choose the zipped file you downloaded earlier and upload it.
After a successful import, you should see a message similar to the one below:
5. Make changes to your database to reflect your new domain name
So, the import is complete, but we have to make some changes so that our website actually shows up on the new URL. We have to make the database point to our new domain name.
In phpMyAdmin, go to the wp-options table of your database.
On the following page, edit the option_value field of the siteurl and home options by replacing the old URL with the new one.
6. Edit the wp-config.php file
The wp-config.php file is a critical file of your WordPress installation, and just like we did in the previous step, we need to make some changes that reflect the domain name change.
Download the file and then open it in a text editor. Replace the database name, user, password, and host details with those of the new database you made in Step 4. Specifically, add the correct parameters for the following functions:
define('DB_NAME', 'new database name here');
define('DB_USER', 'new MySQL database username');
define('DB_PASSWORD', 'password for the new database');
define('DB_HOST', 'new MySQL hostname');
Next, add the following lines of code at the top of the file (below the comments), replacing “newdomain.com” with the correct domain of your site. For this example, the correct parameter would be “https://mybhsite.com”.
See the screenshot below for reference.
Save the file and reupload it to the public_html directory of your remote site in FTP.
7. Run a search-and-replace operation on your new database
There might still be references to the old domain name in the database. So, we have to do what’s called a search and replace: search for each instance of the old URL and replace it with the new URL. If you do it manually, something might break due to issues with data serialization. Thus, we recommend using a plugin like Velvet Blues Update URLs or Better Search Replace. For our example, we’ll be using Better Search Replace.
- Install and activate Better Search Replace at your new admin panel.
- Under Tools, go to Better Search Replace.
- In the Search for field, put your old domain name. In the Replace with field, put your new domain name. Select wp_posts from the Select tables list.
- Next, click on Run Search/Replace at the bottom. Check Run as dry run if you wish to verify the changes before the actual operation takes place. Once you’re happy with the suggested changes, you can uncheck it and run the operation again to make the changes final.
8. Set up redirects on your old site
Now that we’ve migrated our site to the new domain, the only thing left to do is to make our old URL redirect to our new one. The most common way to do so is to set up a 301 redirect. 301 redirects are essential for your SEO performance and your visitors’ experience. When someone visits a page or post on your old domain name, they’ll be redirected automatically to the same page or post on the new domain name.
- Connect to your old domain via FTP.
- Download the .htaccess file to your hard drive. It is usually found in the root directory of your WordPress installation. If it isn’t there, you can look for it in the wp-includes or wp-admin folder.
- Open the .htaccess file in a text editor and add the following lines at the very top:
RewriteRule ^(.*)$ http://www.newsite.com/$1 [R=301,L]
Replace ‘www.newsite.com’ with your new domain name. Save the changes.
- When you visit your old domain now, you should be automatically redirected to the new domain. If that didn’t happen, then the redirection isn’t set up correctly. Seek help from your web host if that is the case.
If you wish to learn more about 301 redirects and how they can help your website’s SEO performance, read this article.
Transfer WordPress site to new domain with a web host
Using a plugin isn’t the only way to transfer WordPress site to another domain. Did you know that most web hosting providers provide the feature to migrate to them for free? In this section, I’ll show you how you can move WordPress site to a new domain name using your existing web host.
We’ll be covering three popular web hosts: WP Engine, Bluehost, and Dreamhost. Whether you wish to change your web host too along with your domain or stick to the same one, the process is the same.
- Log into your WP Engine dashboard, then click on the site you want to migrate to under the Sites section.
- Next, under the Production sidebar, click on Site migration.
- No, go to the admin panel of your site on your existing web host and install and activate the WP Engine Automated Migration plugin. You’ll be asked to log in to your WP Engine account. After logging in, you’ll be taken to the migration form.
- Go back to your WP Engine dashboard and click on Generate Password to generate the FTP credentials you’ll be using to migrate your site.
- Copy the FTP credentials and paste them as is on the migration form. Check the relevant boxes if there are additional root directories or database tables that you want to migrate.
- If your site is password-protected at your existing host and/or WP Engine, then enter those.
- Click Migrate to begin the migration to WP Engine. The WP Engine Automated Migration plugin is powered by BlogVault. It will validate your details on the next page and then start the migration process.
- Once the migration is complete, you’ll see the following screen.
- Log into your Bluehost account. Go to My Sites from the navigation menu, then click on Add site > Migrate Existing Site.
- On the next screen, agree to the terms and click on Get Started Now.
- Next, enter the URL of your website and click on Check so that Bluehost can check for compatibility.
- Install the Bluehost Site Migrator plugin on your site and activate it.
- The plugin will recheck for compatibility. Once it confirms that the migration tool is compatible, click on Start Transfer to begin.
- The plugin will start the migration process. Once it’s complete, perform your post-migration tasks.
- Log into your DreamHost account and navigate to Websites > Manage Websites.
- Click on Add Website to proceed.
- Enter the domain of your site on the next screen.
- Next, choose the type of hosting per your desire, then click on Next: Options.
- Choose Install WordPress for Free so that Dreamhost installs WordPress on this domain. Then, click on Set Up Website to proceed.
- After Dreamhost has finished installing WordPress on your new website, it will take you back to the Manage Websites dashboard. Locate the new site and click on Manage.
- Scroll down to Migrating this site to DreamHost? and click on Get Key. Make a note of this key. You’ll need it soon.
- Enter the key you received in Step 7 and click on Migrate to start the migration process.
- Install and activate the DreamHost Automated Migration plugin on the site you’re migrating. Enter your email address and click on Migrate to continue.
Switch to a new domain only
As I mentioned earlier in the article, if you want to change your domain name but keep the same web host, then you need to change the nameserver information related to it so that your new domain points to your site.
But first, what is a nameserver? A nameserver is a server that maps human-readable domain names (like google.com) to their corresponding IP addresses on the Internet (like 126.96.36.199). For your new domain name to point to your site, you have to put in the nameserver info.
It is essentially a two-step process:
- Retrieve nameserver values from your web host.
- Copy and paste them into the corresponding nameserver fields against your new domain.
You can find the nameserver values typically in the DNS subsection of the Domains section of your web host account’s dashboard. It can take several hours for the nameserver changes to take effect in a process called DNS propagation.
What to consider when moving a WooCommerce site to another domain
For most sites, migrating to another domain is pretty straightforward. With WooCommerce sites, however, things get a little more interesting. Any e-commerce site has transactions taking place in real time as people buy stuff. So, the site is constantly undergoing changes, and as you can imagine, migrating a site while it’s going through changes in real-time can cause errors and break the site.
Therefore, before starting to migrate your WooCommercve site to new domain, we strongly recommend putting it into maintenance mode first using a plugin like Themeisle’s WP Maintenance Mode & Coming Soon. Maintenance mode will “pause” your site, preventing any changes to it. Since this can affect your sales, migrate your site when you expect traffic to be the lowest. Use a tool like Google Analytics to find out such times.
What to consider when migrating a multisite to another domain
Moving a multisite to new domain can be complicated since the database has multiple references to the server name and the folder locations. In addition to the steps I described in the moving a site manually section, you have to manually edit the database. In particular, do the following:
- Search for all instances of your domain name in the wp_x_posts tables and replace them with the new one.
- Edit the wp_blogs entries to change the folder name correctly if you’re moving from one folder to another.
- Review wp_site and wp_blogs to ensure all site changes are correct.
- Edit the following fields in all the wp_x_options tables:
If moving from subdomains to subfolders or vice versa, modify the .htaccess file and the SUBDOMAIN_INSTALL value in your wp-config.php file accordingly.
Things to do after you copy WordPress site to another domain
The migration may be complete, but there are still some things you need to do to ensure a smooth transition to a new domain. If you use Migrate Guru to migrate your site, then you don’t need to do the following steps. It will automatically take care of them for you.
- Disable maintenance mode if you enabled it before migrating.
- Log into your new site’s admin panel and resolve any conflicts regarding themes, plugins, etc.
- Clear all possible caches. This includes the caches of your WordPress installation, browser, and plugins. Caches store copies of your site so that it loads faster, but they may store copies of your old site, which could be a problem.
- Test everything critical component of your site to make sure it’s functioning properly. This includes pages, posts, hyperlinks, images, analytics code snippets, ads, and so on.
- Check theme and plugin licenses. Some licenses are tied to domain names. If that’s the case with you, then contact the respective customer support departments to get your licenses transferred to the new domain.
- Reactivate SSL on your new site to ensure a secure connection when someone visits your site. Use the Really Simple SSL plugin to do so quickly and easily.
- Set up 301 redirects from old URLs to new ones. This is critical for SEO. We covered this earlier in the article. For more information, read our guide on how to set up redirects on your old site.
- Delete your account from your old web host if you switched to a new one.
Phew! Finally, you’re done. You can now focus on managing your site in your new domain.
Troubleshooting issues after migrating WordPress to another domain
Moving a site to a new domain requires a lot of steps, and there is always a possibility of things going wrong. In this section, I’ll outline some of the most common issues.
- The dreaded HTTP 500 ERROR: This error can be caused by several things and can be hard to diagnose and resolve. It is why we advise people to disable caching and firewall plugins and to make sure that the PHP versions on the source and destination sites match. If you get this error, head on over to our guide for troubleshooting it.
- Error establishing database connection: This error is usually caused by incorrect credentials in the wp-config.php file. Check the values for DB_NAME, DB_USER, DB_PASSWORD, DB_HOST, and table_prefix.
- SEO issues: If you see your search engine rankings fall, chances are you haven’t handled the redirects correctly. Read the article that I linked to earlier to fix these issues.
If you’re still pulling your hair out trying to troubleshoot any issues, I suggest taking the nuclear option: reinstall WordPress on your source and destination servers, restore a backup of your site and use Migrate Guru to move it to a new domain. Trust me, it just works.
Should you even switch to a new domain?
There could be several reasons behind the desire to migrate WordPress site to new domain. Some of them are as follows:
- You’re rebranding your business. If you changed the name of your business, it makes sense to change the domain name of your website to reflect the rebranding.
- You want to shorten it so that it’s easier to recognize, spell, pronounce, etc.
- You want a highly sought-after top-level domain (TLD) such as .com.
- Your existing domain name is expensive to renew each year.
- You purchased your domain name and your hosting plan from different providers/organizations. You want to move the domain name to your existing web host to make it easier to manage.
- You’re moving a locally built WordPress site or a development site to the new domain.
Best practices to migrate WordPress site to new domain
I’d like to leave with some advice when it comes to moving a site to a new domain. These are widely accepted tips and techniques because they’re effective and are likely to cause very few issues if any.
- Take a backup of your site before making any changes to it.
- Use a dedicated migration plugin like Migrate Guru or the migration feature of a good backup plugin like BlogVault.
- Keep all your credentials handy. These include FTP credentials for both the source and destination servers, admin panels, domain registrar, etc.
- Make sure the WordPress and PHP versions are the same on both the source and destination servers.
- Deactivate any firewall and caching plugins that you may have. You can reenable them on your new domain.
- Use a maintenance mode plugin to prevent others from making changes to your site during migration.
- Don’t ignore the post-migration checklist that I described above. Your migration may be over, but you still need to take care of some things to ensure a smooth transition.
Moving a WordPress website to a new domain is quite an undertaking and can be daunting. It’s why we recommend the dedicated migration plugin Migrate Guru. It can move WordPress site to new domain easily for free with minimal effort from your side. Migrate Guru works with popular web hosts out of the box.
Q. In what ways can I copy WordPress site to new domain?
A. You can migrate WordPress site to new domain using following methods:
- Use a dedicated migration plugin like Migrate Guru;
- Do it yourself; or
- Use your destination web host itself (provided it has the feature).
Q. What is the easiest and best way to transfer WordPress site to new domain?
A. The easiest way is to use a dedicated plugin. We highly recommend Migrate Guru since it’s easy to use and works with all the popular web hosts out of the box.
Q. How do I move a WordPress site to a new host or server for free?
A. Our recommended plugin Migrate Guru is free to use.
You may also like
Management tools help agencies become well-oiled machines. Each task is completed with the least amount of effort and highest rate of accuracy. For people managing multiple WordPress sites, the daily…
We’ve introduced PHP version 8.3 to our staging sites. Test out new features, code changes, and updates on the latest PHP version without affecting your live website. Update PHP confidently…
WordPress is developed with the scripting language PHP and uses either MySQL or MariaDB as its open-source relational database management system. Behind the scenes, the WordPress database stores content such…
How do you update and backup your website?
Creating Backup and Updating website can be time consuming and error-prone. BlogVault will save you hours everyday while providing you complete peace of mind.