How to Transfer a WordPress Website from One Domain to Another

At some point in your WordPress journey, you’re probably going to need to know how to move a WordPress site from one domain to another without losing any code or data.

If you’ve built your WordPress site on a test domain, if you’ve built it locally on your own computer, or if you simply want to move your site to a new domain name, you’ll need to know how to transfer it without breaking anything.

You can transfer WordPress the “manual” way, but it’s way too easy to break things that way.

Instead, we’re going to talk about how to go the easy route. By far the easiest and fastest way I’ve seen to move a WordPress site from one domain to another is to use a plugin called All-in-One WP Migration.

But first, there are a couple of steps to take if you’re replacing an existing website with a WordPress website.

(If you’re not replacing an existing website, skip down to where it says “Here’s how to migrate a WordPress website”.)

If you’re replacing an existing website with a new WordPress website, read this:

First, backup your existing website.

If your old website is a static HTML site, you can do this by connecting to your hosting account via FTP (using something like Filezilla), then transferring all of the files and folders of your old website into a single folder on your computer that you create. You can call this folder “old site”, or something similar, with the date included in the name of the folder so you’ll know what it is and when it was created.

You can also look for something that says “Backup” in your hosting account control panel. This is where you can create a full backup should you need to revert back for any reason. It never hurts to backup everything you can as often as you can, just in case something goes wrong.

When you’re ready to move your new WordPress site to your actual domain, you’ll need to start by moving your old website’s files into a new folder so you’ll have them for future reference. This will take your website down, so don’t do this until you’re 100% ready to make the switch.

To start, you can either use FTP or go back into your hosting account control panel, and click the link to go to the “file manager”.

You’ll want to create a new folder called “old-site” or whatever you want to call it. Again, it might help to include the date in the name of the folder, that way you remember when you created it if and when you come across it in the future.

Now move all your old website’s files into this folder.

What we’ve essentially done is moved the entire old website into a folder that no one can see online, but that still remains on our hosting account’s server should we ever need it in the future.

Once all the old website files are transferred into this “old-site” folder, you have a couple of options:

You can move your WordPress files and folders from your subdomain’s folder (or “directory”) into the same folder (“directory”) your old website files and folders were in before you moved them.

If you do this, you’ll have to make changes to your database and change URLs so your images and links won’t be broken when you move the site.

OR

You can use a plugin to transfer your new WordPress site. And that’s what we’ll cover now.

Some developers may not agree, but I’ve found that using a plugin is much easier for beginners to move WordPress sites to a live domain without having to worry about breaking anything.

DON’T MAKE ANY CHANGES OR MOVE ANY WEBSITE FILES JUST YET.

You don’t want to move your old website files into another folder without quickly being able to replace them with your new WordPress site.

Here’s how to migrate a WordPress website (the easy way)

Okay, so here’s how to migrate a WordPress website using a plugin.

I’ve tried several plugins, and I’ve also done plenty of manual transfers, and All-in-One WP Migration is without a doubt the easiest.

Some people recommend manual transfers, which leave you in complete control over the transfer process. Transferring a WordPress website manually involves downloading or moving the WordPress files, exporting the database, then re-uploading everything to the new domain and changing information in the database. Then you have to make sure you use a separate plugin to change all the urls from the old domain to the new one so all your links and images don’t break.

Doing it that way is very time-consuming and you’ll almost inevitably mess up somewhere along the way.

The other recommendation I hear a lot is to use a plugin called WP Clone. This plugin is actually the quickest and easiest plugin I’ve ever used to transfer a WordPress site, but the problem with it is, it rarely works. At least it did back when I was trying to use it on a regular basis.

WP Clone lets you create a backup, then it literally just gives you a url to paste into their plugin on your new site (next to “restore from url”), and in no time at all your site is transferred. It was amazing, the few times it actually worked.

I would say about 80% of the time I would get an error page whenever I tried to restore from a backup. It’s a shame too, because whenever I needed to transfer a site, I would always go to WP Clone first because it’s unbelievably simple and fast to use, only to have it give me some kind of error page when I tried to use it.

The people behind WP Clone may have worked those bugs out, but I gave up trying to use it. It might be worth giving it a look to see if it works for you.

All-in-One WP Migration, on the other hand, does the entire transfer process in a matter of minutes and very rarely does it ever give me a problem (and I’ve moved a ton of sites with it).

Every now and then the import process will get stuck and it’s a little frustrating to have to start over, but it still pales in comparison to the frustration you’ll face trying to do it manually.

To use All-in-One WP Migration to move a WordPress website, all you do is:

Install the All-in-One WP Migration plugin on your current site Install WordPress and All-in-One WP Migration on the new domain Use All-in-One WP Migration to export to a file on the old domain Then use All-in-One WP Migration to import that file on the new site

And that’s it!

The settings and import/export sections of All-in-One WP Migration are easy to find (you’ll see them on the left-hand side of your WordPress dashboard once it’s installed and activated), and the process is very intuitive.

However, as I said, every now and then it’ll hang up on you and freeze in the middle of an import, but you can typically resolve that by redoing the process: re-exporting your site, then attempting to import the new export file.

Another way I’ve resolved this is by going directly into my website’s files (either through FTP or cPanel) and manually adding the export file from All-in-One WP Migrate into the backups folder.

The backups folder is usually located just inside the wp-content folder, and should have the word “-backup” in the name of the folder.

You would just move your export file into this folder, then go back into the All-in-One WP Migration plugin dashboard in WordPress, go to the “Backups” section, refresh the page, then you should see the backup you just added in the list of backups. Click “Restore” and you should be good to go.

If you’re having this issue, here’s a great video on how to fix it:

youtube.com/watch?v=mRp7qTFYKgs

*That’s not my video, so I apologize if it’s no longer up.

If you absolutely must migrate your WordPress website manually, here’s how:

*FOR CLARITY, WE’RE GOING TO CALL THE SITE YOU’RE MOVING FROM “THE TEST SITE” AND WE’RE GOING TO CALL THE SITE YOU’RE MOVING TO “THE LIVE SITE”.

Step 1: Connect to your test website’s host via FTP

If your test website is on your localhost, don’t worry about this step.

Download software like Filezilla or Cyberduck, then use your FTP account credentials to connect to your host server. If you’re not sure what your login credentials are for your FTP account, go to your hosting account control panel, then look for anything that says “FTP Accounts”. You should be able to see your login info from there.

Step 2: Backup your test website’s files and folders

You basically need an exact replica of all of your test site’s files and folders, so go ahead and create a new folder on your computer called “test-website” or anything else you like. Then you’ll copy all of your WordPress files from your test site into this new folder on your computer.

Step 3: Export the test site’s database.

To do this, go to your phpMyAdmin on your test site’s host, select the database your test site is using, click export, then export the database. You should get a file that ends with “.sql”.

Step 4: Add a new database for your live site

Now you need to add a new database to your live site’s hosting account, so your WordPress site has a database to use when we move it over. You can do this by logging into your live site’s hosting account control panel, then either go to your “MySQL® Databases” or phpMyAdmin for some local installs.

You’ll have to create a new user or assign a user to this database. Make sure you know the login information for whichever user you add to this new database, because you’ll need it in the next step.

Step 5: Edit your wp-config.php file

Go to the folder on your local computer where you copied your website files to. In that folder, look for a file named “wp-config.php”. Make another copy of this file and put it in a separate folder somewhere else on your computer, just in case anything breaks and you have to use this version of the file again.

Now open the wp-config.php file (the one in your “test-website” folder, not the copy you just made), and find the code that looks like this:



define(‘DB_NAME’, ‘your_db_name’);

The “your_db_name” section should be set to the database name of your test site. This needs to be changed to the name of your live site’s new database – the database you created in the previous step. Now change the database user. Look for this code:

define(‘DB_USER’, ‘your_db_user’);

Change the “your_db_user” part from the username of your test site to the username of your live site’s new database. Now change the database user password. The code will look like this:

define(‘DB_PASSWORD’, ‘your_db_pass’);

Change the “your_db_pass” section to the password you created for your database user.

Now save and close the wp-config.php file.

Step 6: Import your test site’s database

While you’re still in phpMyAdmin, go ahead and select your live site’s database, then click import, and import your test site’s database file into your live site’s database.

Once it’s imported, click into the live site’s database and go into “wp_options”, then change any instance of your test site’s URL to your live site’s URL.

Step 7: Upload the WordPress files and folders on your live site.

Once you’ve added a database to your live site’s host and you’ve updated your wp-config file, you’ll need to go into your FTP client software, connect via FTP to your live site’s host server and go to the directory (folder) of your live site. If the domain you’re migrating to is the primary domain on the hosting account, you’ll simply go to the root directory (which is usually just a folder called “public_html”, “www”, or something along those lines).

Now move all your test website’s WordPress files into this folder where the live site will be.

Step 8: Change out all instances of your old URL in your site’s content.

You’ll probably notice there are images or links that aren’t working now. That’s because they’re still pointing to your test site. There are plugins that will fix this problem, one of which is called “Velvet Blues Update URLs”.

This is the link at the time of this writing: wordpress.org/plugins/velvet-blues-update-urls/

This plugin finds all instances of your test site’s URL and replaces them with your live site’s URL. Just make sure you backup your site before running the plugin, that way you can revert back if anything breaks.