Hosting

How To Move Your WordPress Site To A Different Host Using Locker

July 23, 2012   ·   By   ·   6 Comments   ·   Posted in Hosting, Wordpress

This is a guest post by Chris Stott – a WordPress Web Designer & Consultant at Really Simple Web. He helps small businesses grow online using WordPress by keeping things simple and actionable. You can sign up for his awesome free newsletter here. I’ve been in touch with Chris on and off for quite a while – he’s a great guy who does great work.

At sometime throughout your career of running a WordPress website you are likely to need to move to a different host for some reason or another. Hopefully, this will be because your site has out-grown your current host and you require something more powerful. More often than not, hosting companies upset people in some way and you need to move.

I find that people don’t switch and put up with an expensive host they have been with since they started out as they are daunted at the prospect of moving to another provider. Fortunately Code Garage makes the process much easier when moving a WordPress site!

In this post I’m going to show you how to move your site from one host to another quickly and easily. If you need to move hosts, don’t put this off. Just dive in.

Assumptions:

  • You are moving the website to a new host but the domain name will remain the same.
  • You are OK to make minor edits with a text file and use an FTP programme.
  • You are running Code Garage backups on your site.

Before We Begin

You need to have 2 things in place.

  1. You need an account setup with the next host you are moving too. You’ll also have setup your domain on your new host ready.
  2. You need to have Code Garage’s plugin installed for 24 hours so that it has had time to complete a full backup of your site.

Tools

Your going to need a couple of bits of software to make this process easier, don’t worry they’re free.

  1. A FTP client – I recommend FileZilla as it is free and highly respected.
  2. You will also need a text editor. This can be text edit on the Mac, or notepad on Windows. Better is Notepad++ on Windows or TextWrangler on the Mac (both are free).

Once you have these things in place you are ready to move your site.

Preparation

It’s worth doing a bit of spring cleaning on your existing site such as getting rid of plugins, spam comments, themes and more that you don’t need. Also you might as well make sure WordPress and all your plugins are fully up to date. This is just a good opportunity and means you have less stuff to move. Remember that once you do this you’ll need to wait for another backup cycle so that Code Garage has the latest backup of your new site. All this means that when it comes to start the transfer we have a nice clean backup to work with.

Moving Your WordPress Site

STEP 1: Download Your Code Garage Backups

There are two files you are going to need to download. Your latest ‘Files’ and your latest ‘Database’. Remember that once you download these to your computer they are snapshots of your site at the time of the last backup. If you get delayed in moving your site, you might want to start with the latest backup as Code Garage will continue to run in the background of your existing site until you complete the transfer.

STEP 2: Set up and Configure A New Database

This is about as technical as it gets, and it’s not that daunting I promise – I’ll walk you through every step. Unfortunately you can’t quite just copy and paste your files, you need to create a fresh database on your new host.

Here’s what I need you to do. Most of you, I imagine will have hosting with a cPanel backend, if not (mine is xTend backend) you’ll find they are very similar.

To create a new database you can either use the wizard (1 in the image below) or you can go in to myPHP admin (2 in the image below) yourself and do it from there – note that some hosting won’t have the wizard, so just use php MyAdmin (2) to do this. You’ll need to make sure that you make a note of the database name, username and password created as you’ll need this information in a bit. It’s easier to just save it in a text file so you can copy and paste it later. Note: Your Database name and username are often the same.


Next you are going to need to import your existing database (the .sql file that you downloaded from Code Garage) in to your new database (the one you just created). This is easy. Head over to phpMyAdmin in your hosting cPanel. Select the database you just created (this is important as I sometimes forget this step and get errors).


Now import your Code Garage database backup (the sql file) to that new Database.


The final technical step of getting your new database ready is to tell your WordPress site how to access the new database. To do this you are going to need to manually edit some files.

Unzip that Code Garage backup of your site files that you have (you’re going to need to do that ready to upload them anyway).

Navigate to the file wp-config.php file in the root folder and open it with a text editor.


You want to navigate to the database details which are near the top of the file. Here you are going to want to change the database details: database name, user and password to those of the Database you created on your new host. Save that file over the existing file so it becomes your only wp-config.php file in your folder (make sure that you save it in the same format don’t let your text editor convert it to rich text or anything).


Right that’s your database setup, we are now ready to upload the rest of your site to your new host.

STEP 3: Upload Your Site To New Host

You are going to need to use an FTP programme for this step. You should have your FTP login information in your welcome email from your host, otherwise you can setup FTP users via your hosting control panel. Some hosts will require you to unlock your FTP access either by time period or IP address, so you’ll need to do that to get access.

Put your FTP details in to your FTP programme and let’s get connected.

You are going to navigate to your new site location on your server. Depending on the type of hosting you are using this will probably be the Public_HTML folder under the folder for the new site you’ve allocated to your domain.


Once you find this make sure that you delete any files within that folder. Again, depending on your host, this could be an index.html file or similar.

Now upload the contents of your Code Garage backup of your files that you have unzipped so that becomes the contents of your public_html folder. You want to upload at the level where your wp-config.php file is. You can select all files using CTRL+A on a PC or CMD+A on a Mac.

Here’s where we wait for the files to upload.

STEP 4: Check Everything is OK.

All the folders look like they are in the right place (they should look like the image below) and it’s worth opening your wp-config.php file on your new server to check that it has the right DB names etc.

STEP 5: Change Your DNS

Let’s recap where we are. You currently have a new host with a new database setup and your existing database imported in to that. You also have all your files uploaded to your new server, in the right place, from your Code Garage backup. You’ve edited the wp-config.php which got uploaded to your new hosting so that it has the new database details.

For the moment however your site is still operating from your old host. It’s time to make the final switch to your new hosting. This is where we tell your domain name to point at your new host. This requires you to change your DNS settings with your domain registrar.

A word of warning before you do this. Your DNS settings will also control your email. If you’ve just got a forwarding address that’ll be fine, but if you have added Google Apps or a particular inbox you are going to need to make sure you provision the changes for that as well. You’ll need to edit the MX records on your new host prior to the switch. Find out more about moving Google Apps to a different host here.

Within your registrars domain management site, navigate to the domain we are dealing with and then select DNS setup or equivalent. I use Namecheap so this is what it looks like for me:

Now you just need to update your DNS settings to point at your new host and then wait for your site to switch. This can take around 24 hours but is usually much quicker.

STEP 6: Test everything!

Check everything is working, check all the right plugins are active, have a click around.

It’s worth keep your old host running for a week or so until you are happy everything is running fine on your new host, because if you have a problem you can easily switch the DNS back to your old host.

There you have it, using this guide and your Code Garage backups it is easier than you think to switch your hosting to a new provider.

I hope you found this guide useful. If you have any questions please leave a comment I’d be happy to help.

6 Comments
  1. Thanks for the opportunity to post on Code Garage!

    If anyone has any questions, I’d be happy to help.

  2. Is it possible to send the backup files directly to a web server? I’ve got a 2.5+ GB site I need to migrate.. #facepalm

    • Hey David –

      A site that big can be a tall order. My best experiences with moving sites like that are generally when I’ve got ssh access to teh server I’m moving *to*. With SSH access, you can either use wget to download a zip of the site from the old server, or if you’ve also got SSH access to the old server, you can often use SCP (again – from the command line) to copy the site straight over.

      Both ways save massive amounts of time because the connections speeds on the servers are (generally) much, much faster than your local connection, and it cuts out a step entirely.

      Of course, you have to at least have the ability to zip up the site on the old server, and you have to have SSH access on the new server.

      Depending on your server configuration, you might also be able to put together a script (or use a script someone else ahs put together) to use PHP to download a massive site directly to the new server in chunks.

      If you need more help/direction, get in touch through the contact form.

      Good luck!

      • Hey Peter, appreciate you taking the time to reply. That’s exactly what I did – I zipped the old site up and then SSH-ed into the old server and FTP-d it over to the new server. Luckily I had SSH on the old server!

  3. I had to figure this out myself when I was using wordpress for my own website…. Great and informative post though.

Submit a Comment