Thinking of moving your WordPress site to a new server? Whether you found a new hosting plan in your existing hosting company or are ready to switch to a new hosting provider, don’t let your WordPress site chain you to your existing account. WordPress is designed to work in a modular way, and you can transfer your entire site to a new home. The transfer process is not very difficult, but it’s time consuming. Account for many hours of work to complete the steps below.

Each WordPress installation has two main components: your files and your database. In this article, I’ll explain how you can move these components, and then connect them again in the new server.

Step 1: Backup your files and folders

I know this sounds trivial, and may be a big hassle for some, but it’s an absolute must. Make sure that you use an FTP program (such as Filezilla) to login to your old server and download all of your Worpress files. This includes key folders such as “wp-content”, “wp-include” as well as every single file that you will need. This may also be a good time to do some clean up and get rid of files that you no longer need (e.g., logs, temporary files, spammy comments, etc.).

FTP screenshot of wordpress files

Here are your WordPress files. We need them all!

Step 2: Backup your MySQL database

Many of the awesome features that make WordPress so popular are based on its database-driven structure. Your posts, your user’s login information, all of the comments, and so many other part of your WordPress site reside in the database. Use phpMyAdmin to login to your database and use the “Export” command to download all of your data. Preferably in SQL format with the default export settings. Depending on the size of your WordPress site, this SQL file can be quite big. Make sure that it’s safely stored in a backup location. If you have custom data tables that are part of your WordPress site, don’t forget to export these as well.

Exporting your WordPress database

Exporting your WordPress database: Select “Export” in phpMyAdmin…

 

Exporting SQL in phpMyAdmin

…and then select “SQL” format.

 

Step 3: Install the latest version of Worpress in your new server

One of the easiest ways to “move” your WordPress site is to install a new (and empty) WordPress site and then copy your own files over this fresh install. Depending on your web hosting provider, there can be a “one click install” option (for example in Fantastico). If this feature is not available in your new hosting provider, then you’ll need to download the latest WordPress installation files and follow these instructions. Mind you, the manual installation can be a bit complicated, so the availability of an automated WordPress installation should factor in your decision when you’re choosing a new web hosting service. When the installation is complete, you should see the WordPress folders (“wp-admin”, “wp-content”, “wp-includes”, etc.) as well as a new database that goes hand-in-hand with this fresh install. If you have any control on the name, username and password of the database, choose the exact same ones as your existing database. This will save you some time in Step 6.

Tip: Depending on your preference, you can install WordPress at the top of your domain (e.g., myWordpressSite.com) or as a sub-folder (e.g., myWordpressSite.com/blog). Make sure that the location of the fresh WordPress installation matches your original site.

Step 4: Copy your files and folders over to the new server

Using an FTP program such as Filezilla, login to the ftp account in your new server and locate the WordPress folders (“wp-admin”, “wp-content”, “wp-includes”, etc.). Then, copy the files from your existing WordPress site (that you backed up in Step 1) onto the fresh install. At this point, you will be overwriting all of the files in the new server. This shouldn’t be a problem, as there is no content there (yet).

Step 5: Import your MySQL database to the new server

phpMyAdmin has a handy “import” feature that you can use to move your existing database into the new database created by the fresh WordPress installation. First, let’s “drop” the data tables that were created as part of the fresh install. Now, check the size of the SQL file that you created as part of Step 2. If this file is larger than 7-8 Mbytes, the chances are that you’ll have some trouble importing it. There are three ways to get around this: you can try zipping the entire SQL file, you can export and then import data tables individually (instead of one big SQL file, you’ll be dealing with many smaller ones)¬† or you can ask for some help from your new hosting provider to upload the MySQL datatables. phpMyAdmin can import zipped SQL files without any need to unzip them manually. This step is probably one of the more difficult ones in the process, so take your time, and make sure that the imported tables match the older ones (for example by checking the number of records and/or size of each data table).

Importing SQL in phpMyAdmin

Importing the SQL file you saved in Step 2.

Step 6: Edit the wp-config.php file

The “glue” that binds your files and folders to your SQL database is the “wp-config.php” file which should be located at the top level directory of your WordPress installation (e.g., at the same directory level as the “wp-content” folder). You need to edit this file using your favorite text editor. Locate the section that begins with:

// ** MySQL settings – You can get this info from your web host ** //.

You need to change the ‘DB_NAME’, ‘DB_USER’,’DB_PASSWORD’ and ‘DB_HOST’ fields to match your existing database. Please note that the last field (‘DB_HOST’) may be “localhost” in both existing and the new installations. In this case you can just leave it as is.

Step 7: Load your WordPress site from the new server

In certain cases, you can use a temporary URL to see if the import process was successful so far. If your new web host cannot assign you a temporary URL, you’ll need to skip to the next step. If you can see your site, check it for completeness. The temporary URL may cause some strange behaviour, especially if there are some hard-coded links in your website. This is normal, and when you complete the next step, these links should not be broken any more.

Step 8: Change your nameservers to point to your new server

The ultimate test is to change the nameservers of your domain address and point them to your new home. If the new installation is done properly, your users will not experience any down time and the transition will be seamless. However, this may not be possible for all web hosting companies. Therefore you should complete this last step when your traffic is at its lowest point to minimize disruption. Once your new IP address is “propagated” to various servers around the world, your users will start coming to your new home. This transition period may take a couple hours, so continue checking until you see your domain name resolving to the new IP address. If you suspect that something is not right, you can use a DNS propogation tester to check the IP address that your domain name is pointing to. This IP address should be the one provided to you by your new hosting company.

That’s it! Congratulations! You have successfully moved your WordPress site.