How to migrate a WordPress installation to another domain.

November 12, 2012

I visit the WordPress support forum on a regular basis (or at least when I have a few minutes to spare) and I see time and time again people who move their WordPress installation from one domain to another for whatever reason. The outcome is usually the same… information gets lost, plugins have to be reconfigured, and things just plain don’t work! I’m always tempted to write back to these individuals and give them a lengthy (but simple) step-by-step on how to do this successfully every time. What stops me? Well, for one I don’t like to repeat myself. Second, it’s lengthy and a forum is just not the place to give that type of support! So I came to the conclusion that perhaps a nice blog entry with detailed step-by-step instructions would help. Then I can simply send these people a link and hope it helps them in some way.

This process WILL work, and will work flawlessly each and every time. How do I know? Our company does it on a regular basis… sometimes daily. All of our clients are first created as a sub-domain on our server. When the site is ready to go live, we port the entire installation to their own domain. You could say that we have a lot of experience in doing this. Here’s the disclosure though, before I even start:

First of all, this tutorial assumes your website is 100% WordPress, meaning your entire website runs off of a WordPress theme that you bought, downloaded or created yourself. It also assumes you keep your WordPress installation up-to-date… plugins, themes and core WordPress files! And it assumes that WordPress is installed in the ROOT of your web server. It will work for sub folder installations, but you’d have to tweak a few steps.

In order for this process to work, you must have access to the SQL database on both the current domain and the future domain. You don’t need to know the SQL language, so don’t be nervous. Second, you’ll need to have some FTP experience. We recommend you use an FTP program called FileZilla. It’s free, so that’s a plus, and it’s fast.

As long as you meet these two requirements, read on and enjoy moving your WordPress installation from one domain to another as many times as you want! It’s so easy, you may do it 50 times just because you can! Keep an open mind… though these steps look long, they are only long because I want to explain in detail what’s going on. Once you do this once, you’ll see how fast and easy it really is.

Make a Backup of Your Files

In the world of technology, where ever you go, what ever you do, you’ll always hear one phrase repeated over and over again… backup your data. If things go wrong, we can put them back! If you fail to backup your data, then you’ll be sorry. Maybe not today, maybe not tomorrow, but soon… and for the rest of your life! So this is, of course, step one… backup your data.

Using your FTP client, log into your current website. We’ll assume that you are using our recommended FTP Client, FileZilla. If you are not, we HIGHLY recommended reading up on the documentation for the FTP client you are using to connect properly. Most of the FTP clients are similar… you have a way to enter the host name, the user name, and the password. Then there are two windows/areas… one for the local file system and one for the remote file system.

Using FileZilla, there is a “Quickconnect” bar along the top. Enter the “Host,” which would be the name of your current domain, replacing the “http://” with “ftp://.” So in our case it would be Two things to keep in mind… some hosts will not need/require the “www.” If at first you don’t succeed, remove/add the “www” and see what happens. In our case, if this login attempt fails, we’ll try The second thing to look for is a secure FTP connection, or SFTP. Some hosts will require that any FTP attempt is done through secure FTP, and therefor deny access through standard FTP. If this is your case, change ftp:// to sftp://. Again, in our case we’d use s or s accordingly.

Next we enter our FTP/SFTP username, and the FTP/SFTP password. This is provided by your hosting company, or something that you’ve created yourself depending on how much control you have over your hosting server. In our case… ah, I bet you thought I was going to give away the keys to the kingdom, eh? At any rate, if you don’t know the username/password to your FTP account, simply call your hosting company and they should be more than happy to help out. If they aren’t, find a new hosting company :).

Once successfully connected through FTP, you’ll see all your remote files (those files located on your hosting company’s server). You’ll also have a window that shows your local file system (the computer you are currently sitting at while doing all this work). These windows are usually clearly labelled. On the “Local Site”, navigate to a folder where you can do your backup. Make it an easy location you can remember, like “My Documents” or even a new folder on your “Desktop.”

The next step is to navigate to your “Root” folder of your current website on the “Remote Site,” where your WordPress installation lives. This step might confuse some people who are not familiar with the folder structure of their hosting company. A Window’s server running IIS might have something set up under a folder called “public_html” or something similiar. An Linux server running Apache might have a folder structure similar to /home/{your ftp username}/ Each system is different, so check with your hosting company to know where your website is saved!

At this point, simply copy the entire “wp-content” folder (and everything inside, of course) down to your local computer in the folder you chose previously. The reason we copy this folder down is because it contains all of your WordPress plugins, all of your theme files, and all of your uploads (pictures, documents, whatever). This is the guts of your personal website. But what about all those other folders and files? Aren’t they important? Of course they are… but those files are standard WordPress installation files. We’ll put those on the new server as a fresh install to make sure we have no bugs or errors. Trust me, it’ll all work out.

Figure 1: Click for a full sized image. Note that some fields are removed for security reasons.

Make a Backup of Your Database

Now that our files are safe and sound, let’s secure our database. WordPress has a way of backing up your database through it’s admin interface. We have found this to be less desirable as you don’t get ALL of the important database information, requiring you to recreate certain things on your new domain. And there might be other plugins out there to help accomplish this as well, but we aren’t familiar with them. What we do know is there’s no better way to get all your information then to get your entire SQL database in one shot and move that server to server! Here’s the skinny on that:

Log in to your current domain’s control panel. Almost every host has some form of control panel where you configure DNS, setup/create SQL databases, and manage other small resources. Contact your hosting company if you aren’t familiar with this option. Almost every hosting company I’ve dealt with uses phpmyadmin to service their SQL databases. It’s free and very user friendly. We’ll assume you have that and are able to use it. Through the control panel, you should be able to launch your phpmyadmin for your WordPress database. Here’s a screenshot I grabbed from Google images to show a quick example. Though your control panel may look very different, you should still see a database section with phpmyadmin available:

Figure 2: Click for a full sized image. Note that your control panel could look VERY different.

Side note: if you don’t know the name of your WordPress database, or even where the database lives, you can access this information by opening wp-config.php. Using the method above, FTP into your current domain and you’ll find wp-config.php on the root of your WordPress installation. Open this file in a text editor and look for a line of code that looks like:

define( 'DB_NAME', 'somevaluehere' );

That will be the name of the database that stores all your WordPress information. Typically you’ll only have one database anyway, but this will reduce any confusion if you work with more than one WordPress installation.

Back to the backup… Once you’ve launched phpmyadmin, select your database from the navigation on the left.

Figure 3: Click for a full sized image. Note that some fields are removed for security reasons.

You’ll see all the tables associated with that database, plus a series of tabs that run along the top. One of these tabs is labeled “Export.” Click on that, and you’ll be given a bunch of options.

Figure 4: Click for a full sized image. Note that some fields are removed for security reasons.

If you’ve done things right so far (you know, clicked the two links mentioned), then you should be able to leave everything default. If you want to get fancy, play with some of the options… but for the sake of this tutorial, don’t. Use the screenshot as a guide to what the default options should be. If yours looks different, try to match it up to the screenshot. Basically, you want to have ALL of your tables selected for export, you want to export in SQL format, and you want to export both the structure and the data.

Figure 5: Click for a full sized image. Note that some fields are removed for security reasons.

At this point you should have the option at the very bottom to “Save as File.” Simply check this box and press the “Go” button. This will prompt you to save/open the file, just like any other time you’ve downloaded files from the internet. Save the file to the desktop, or somewhere you’ll be able to find it later.

Figure 6: Click for a full sized image. Note that some fields are removed for security reasons.

That’s it… the database is now safe and sound. If things go south after this point, we can fully recover our WordPress install and be back in business in 4 minutes. Though unless you deviate from these instructions, nothing will go south.

Setting Up the NEW Database

Now that we’ve backed up our live and current site, let’s focus on our new domain. The first thing we need to do is recreate our database on the new server. Using the same approach we’ve already talked about (this is familiar territory so there’s nothing to worry about!), log into your NEW domain’s server control panel and create a new database! This time, we won’t launch phpmyadmin… at least not yet. Instead, use the MySQL Database option (or similar) to go through the process of creating a new database. All you need to do is create a simple database with a name, username and password. Follow the directions from the hosting company’s control panel. When in doubt, call them. They’ll be happy to help. You’ll want to write down the database name, username and password (and if you’ve used something other than wp_ as a table prefix, make note of that as well) somewhere so you can reference them later when we install WordPress.

Now that the new database is created, let’s populate it. Go back to the control panel and launch phpmyadmin at this point. You should see the new database you just created over in the left hand navigation! Please note that it may take a few minutes for the hosting company to create the database… so if it’s not there right away, wait about 5-10 minutes and try again. Once you’ve click on the name of the database, you’ll get that same tab system across the top! Instead of “Export,” we want the “Import” button. Then, browse to where ever you saved the SQL database from before and select the file. You’ll notice at this point ALL of the other fields will get updated accordingly (or stay the default)… what a smart system! At the very top of the phpmyadmin screen, you’ll see the database host name next to the word “Server:” that you don’t want to forget to write down.

Figure 7: Click for a full sized image.

Now that we’ve chosen the correct file, click the “Go” button and the import of all the data from our current WordPress install goes into the new domain’s database! Please note that we do this process BEFORE we install WordPress on the new domain because we don’t want the WordPress installer to create these tables and whatnot for us! And at this point, we are done with the control panel and MySQL. Half way there!

Installing WordPress on the New Domain

Go to and download the latest and greatest version of WordPress. If you’ve kept up-to-date with the upgrades, your version of WordPress on the old server will match. Extract the files inside the zip to a folder somewhere you’ll remember.

Let’s get back to FileZilla… we should still have it open, but we need to change servers! In that same “Quickconnect” bar, change the host, username and password to reflect the new server. Press “Quickconnect” and you’ll be prompted to open this connection in a new tab, or abort the current connection. Either way works, but for now let’s abort the current connection. Navigate to where you saved the WordPress installation folder… and put all the files INSIDE the WordPress folder on the root of the new domain. So the root should now contain the “wp-admin,” “wp-content,” “wp-includes” folders and appropriate files. If your root contains one “wordpress” folder, then you didn’t follow directions. Just delete it and move the CONTENTS of the “wordpress” folder over instead.

Figure 8: Click for a full sized image. Note that some fields are removed for security reasons.

The next step is to upload your wp-content folder we backed up from the old domain. The contents of the wp-content folder should OVERWRITE the contents of the pre-installed wp-content folder that comes with WordPress. What I would recommend is to simply delete the wp-content off the server and upload your version.

The next step is to visit the new domain. Open your favorite web browser… Firefox or Chrome, for example… and enter (using your real domain name). You’ll get the WordPress installation screen indicating there is no configuration file yet created! Follow the directions on the screen to create one. Be sure to use the NEW database’s name, username, password, host name, and table prefix we recorded in an earlier step. Clicking on “Submit” you should get the “Alright Sparky” page we all know and love. Click the “Run the Install” button. Now you should get an “Already Installed” box! This is new… it’s because it found the database and all the tables. What’s better, it found the Admin account you had on the old system as well! One thing you don’t have to recreate!


Don’t go any further… don’t attempt to look at your website as it’s currently broken! Because you imported all the data over from the old domain, the database is loaded with links pointing to the old domain. This is the last step we need to fix! Go to and download the “Search Replace DB V 2.1.0.” Of course, you should FULLY read this page to understand what’s happening… but here’s the low down:

WordPress stores its data inside the database in a serialized format. The serialized data looks something like this:


Now, I don’t know what that says… or means! But PHP does… and the bottom line is that number that comes after ever “s:” MUST match the length of the string that follows. Taking the following example, the first “s:” we come across is:


So you have the “s” followed by a colon, followed by the number 28, followed by another colon, followed by a string inside double quotes. Looking a littler deeper and you see that whatever is inside the quotes must be 28 characters long… go ahead and count it out if you don’t believe me. If we do a simple find and replace using the phpmyadmin, you’ll find and replace what you want, but you’ll change the string length without changing the numerical value that comes after the “s:”. So if we were changing domains (which is what we are doing) and we had a serialized string in the database that said:


and we did a simple find and replace inside the database itself to find “” and replace it with “,” you’d replace that serialized string with:


which looks good, but counting the characters inside the string you’d get 29 characters, not 31. PHP would get this serialized string and, because the number doesn’t match the length of the string, PHP would throw that data away because it’s “corrupt.” Get it?

The fix to this is to use the “Search Replace DB V 2.1.0” file we downloaded above. Following the directions, we are suppose to place this file in the ROOT of our installation. Go ahead and use FileZilla to upload this file to the root of the new website. You should know how to do this by now!

Figure 9: Click for a full sized image. Note that some fields are removed for security reasons.

Now visit (using your real domain name of course) and follow the instructions. What’s nice is that you can (and absolutely should) leave all the defaults until you get to the actual string you want to find and replace! So on the first page, click “Submit!” The second page should show you all the information found inside the wp-config.php file… your database name, the password, the username, and the host name! Make sure this is accurate and click “Submit DB Details.” The next page, “What tables do you want to scan?”… well, ALL of them. They should already be highlighted anyways… and no, we do not want to leave the GUID column unchanged, so leave that unchecked. The last page is the find and replace with text areas… what you want to do here is enter “” in the “Search For” box, and “” in the “Replace with” box.

NOTE: You want to LEAVE OUT the http:// and the www. This way you will find ALL occurrences of your old domain name and replace it with the new domain name. This is important!

Now click “Submit Search String” and wait… this could take a few minutes depending on the size of the database, but usually it’s fast.

We’re Finished!

Well, almost… now that we’ve corrected our database, the only thing left to do is DELETE THE “SEARCHREPLACEDB2.PHP” file off our server. DO NOT FORGET THIS STEP!!! If you don’t delete this file, ANYONE CAN ACCESS YOUR DATABASE AND DO WHATEVER THEY WANT! I know that’s a lot of bold text, but this is super important. This file will grant anyone access to your database, so delete it, and do so as soon as is physically possible!

Now you can take a deep breath, go to and squeal with delight. Just try to do so in a private place as squealing usually isn’t an accepted form of excitement in public! Feel free to leave any remarks if you know a better way to do this. Remember, if you break this down to it’s core and simply remove all my fluff explanations, these are the real steps:

  1. Using an FTP client, log into your OLD domain and backup the wp-content folder.
  2. Using the OLD hosting company’s control panel, export your entire WordPress database using phpmyadmin and the export tab. Make note of the table prefix if it’s different than “wp_”.
  3. Using the NEW hosting company’s control panel, create a new database and remember the database name, username, password, and host name.
  4. Using the NEW hosting company’s control panel, import your entire WordPress database using phpmyadmin and the import tab.
  5. Download a fresh copy of WordPress.
  6. Using an FTP client, log into your NEW domain and upload the contents of the WordPress install folder to the root.
  7. Delete the wp-content folder off the NEW domain and replace it with your backup from the OLD domain.
  8. Visit your NEW domain and follow the instructions for creating a configuration file. Use the information recorded in steps 2 and 3.
  9. Go to and download the “Search Replace DB v 2.1.0 file. Upload that to the root of the NEW domain.
  10. Visit your NEW domain/searchreplacedb2.php and use all the default settings. Search for “” and replace it with “”.
  11. DELETE THE searchreplacedb2.php FROM THE NEW DOMAIN RIGHT AWAY.
  12. Enjoy your old website on your new domain.
Posted in Technical


The Author: Dan

Dan’s an expert in programming, middleware and scripting language including Javascript, jQuery, PHP, SQL, MySQL, ColdFusion, ASP, ASP.NET, C#.Net, VB.NET and Actionscript 3.0. In other words, he speaks the language of the latest technology to ensure that our clients have the very best web solutions.

Leave a Reply

Your email address will not be published. Required fields are marked *