How to Move Your Website To a New Host/Server

December 1, 2012 — 2 Comments

Have you ever thought about changing hosting providers but hesitated because it seems like a such huge undertaking? Well, I recently took on the daunting task of moving GeekRev to a new hosting provider. But, it wasn’t as daunting as you might think. In fact it’s pretty easy, but it can take a long time.  @seventy8prod suggested that I write a post detailing what I did. So, here it is. Enjoy (after the break).

Start Here.

First, you might refer back to the reason why I moved to a new hosting provider to bolster your resolve to take the plunge. Once, you’ve gathered your courage, you can follow along with the steps I took. Of course, they are written from the standpoint of how my servers work and how my domain name service works.

I will elaborate on the steps later, but here they are:

  1. Backup your database
  2. Backup your files
  3. Post a “We’re Moving” post on your OLD site.
  4. Setup your new database.
  5. “Restore” your OLD database to the NEW server.
  6. Point WordPress to your new database.
  7. Upload your files to the new server.
  8. Test it out if you can.
  9. Change Your DNS settings.
  10. Fix any path issues.

Backup your database.

I use WordPress for my site. There are several nifty plugins to help you keep your database backed-up. I use two. The first is WordPress Backup to Dropbox. It let’s me set a schedule to back-up my database to an “offline” place. “Offline” means “not in the same place as my server.” This is important because if you site goes down, your back-up is still accessible.

The other backup plugin I use is DBC Backup 2. It let’s me schedule backups to a folder on the same server as my website, which I do. But, that’s not the real reason I use. I use it because I can do an on-demand back-up at any time, very easily.

Whatever tool you use, backup your database. Then download the backup file to your desktop computer.

Backup your files.

I think this is a place where many people get confused. The backup tools mentioned above only backup the database of your site. The database contains all the raw information of your site. It does not include things like images, theme files, WordPress application files, etc. If you have a website, I would hope you know how to use an FTP client (I use Filezilla).

I made a new folder on my computer called “GeekRevBackupFiles” to hold my file-backup. In Filezilla, The left pane is my computer and the right pane is the web-server. Once I connected to the OLD server, on the left, I navigated into my “GeekRevBackupFiles” folder. On the right, navigated into the folder that holds my actual website files. This is usually “public_html” or “www” in some cases – if you have both that means they are actually the same folder, so it does not matter which one you navigate to.

On the right pane (web server), I highlighted everything, except the “cgi-bin” folder, because that is usually something put there by the hosting provider with some “tools” that you may or may not use. Once highlighted, I dragged it all onto the left pane. Go get coffee, a bagel – this can take a while on a site that’s been around a while.

Post a “We’re Moving” post on your OLD site.

After completing the steps above, make a new post on your OLD server telling visitors that you are moving the site, and that you appreciate their patience while you do so, This is done AFTER you’ve backed up your database because we do not want this post to appear on the new site. This post has a dual purpose. First it is a courtesy to your visitors. Second, when you make DNS changes later on, it may take a day or two to completely cut-off traffic from your OLD site. This gives you a good way to tell if you are on the OLD site (WITH this post) or on the NEW site (WITHOUT this post).

Setup your NEW database.

Every web-host I’ve ever used allows you to launch a program called phpMyAdmin. On my new server, it’s located in my CPANEL administration system. When you purchased your new server space, you should have received an email telling you how to access this stuff. I’m leaving that up to you to figure out.

My new server’s phpMyAdmin installation does not let me create databases and database users. I have to do that with a “Database” icon in my CPANEL.

I created a new database, but was forced to add a prefix that was different than the one used on the old server. The old server made me name my database something like “GeekRev_myDatabase” but the new server made me call it something like “SomethingElse_myDatabase” – this is something you need to remember in a moment.

I also created a new database user because I did not want the database and my ftp using the same password. You have to connect the user to the database you made. This varies on different servers, so again, I leave that up to you to figure out how. But, it’s usually in the same place as where you made a database and user.

You need to write down these 3 pieces of information:

  1. database name
  2. database user name
  3. database user password

“Restore” your OLD to the NEW server.

Once you have the database created, and a user created and associated with the new database, you are ready to “restore” your old database to the new server.

In phpMyAdmin, first select your database from the list on the left pane, by clicking it’s name. Once the page reloads, you should see a row of icons across the right pane. One of them is labeled “Import” – click it.

You will get a screen that lets you browse for a file to upload. Hit the browse button and find that database backup file you that you copied to your computer. Once selected, scroll down the page to find the “Go” button. Now, do not touch the screen until you get a “Success” message.

Point WordPress to your new database.

Remember above, I mentioned you needed to remember what you named your database to? Well, now is when you need that information.

In Finder (mac) or Windows Explorer, navigate to the folder where you backed up your FILES. Remember, my folder was named “GeekRevBackupFiles.” Once there, find a file called “wp-config.php” and open this in a text editor. You will need to find 3 values in this file and change them.

First, find the line that looks similar to this:

define(‘DB_NAME’, ‘blahblahblah’);

Yours will have something different where it says “blahblahblah” – change the blahblahblah part to your database name.

Second, find the line that looks similar to this:

define(‘DB_USER’, ‘blahblahblah’);

Yours will have something different where it says “blahblahblah” – change the blahblahblah part to your database USER name.

Third, find the line that looks something like this:

define(‘DB_PASSWORD’, ‘blahblahblah’);

Yours will have something different where it says “blahblahblah” – change the blahblahblah part to your database USER PASSWORD.

SAVE THIS FILE.

Upload your files to the new server.

Open up Fillezilla again and connect to your NEW server. On the left pane, navigate to the folder where you backed up your files – remember mine was called “GeekRevBackupFiles.” On the right pane, go into the folder where you are supposed to put your files. This is typically “public_html” or “www” – if you have both that means they are actually the same folder, so it does not matter which one you navigate to.

Highlight all the files from the left pane, and drag them into the right pane. Once again, go get coffee, a bagel – this will usually take even longer because for most internet connections, uploading is much slower than downloading.

Change the https://dl.dropbox.com/u/1854247/phpinfo.php

Test it out if you can.

Once you’ve reached this point, the site should be working, but we still haven’t told the world to look at your new server (DNS changes). Typically, hosting providers will give you a way to see your NEW site before DNS changes have set-in. If not, you won’t be able to see anything on the new server until the DNS change has occurred. If you can’t test it at this point, you will just have to wait until the DNS settings kick-in, which leads us to the next step.

Change Your DNS settings.

For good or bad, I use GoDaddy. Why? Because they have the best back-end domain management system I’ve ever seen. If you don’t think I should use GoDaddy, please DO NOT tell me. I’ve made my choice (grin).

Anyway – log-in to your domain service’s user panel, find your domain listed in your account, and look for a way to change the “NameServer” settings. When you bought your new server space, they should have sent an email telling you what to set the “NameServers” to. Usually you can enter four “NameServers” but your hosting provider may have only given you one or two.

In the “NameServer” settings area, DELETE all the old “NameServer” info from the input boxes, so that they are all blank. Starting with the first input box, input the “NameServer”info from your hosting provider. It’s OK that some are left blank.

SAVE these settings.

Understand that it can take a few days for all the “NameServers” on the internet to change their records to point to your new site. During this “propagation” time, you may sometimes see the old server, and other times see the new, depending on where you access the site. After a couple days, you should be set.

Fix any path issues.

Once your new site is showing up, you might still have some issues. For example, some plug-ins in WordPress require that you enter explicit paths in the settings. These are not public URLs, but server-side internal paths. The DBC Backup 2 plugin that I use is one of these. I can almost guarantee that these internal paths will be different from your old server. You need to go into your settings panels for all your plugins and fix these. Unfortunately, some times it is hard to find these internal paths.

Fortunately, there is a solution.

Download this file (phpinfo.php right click on the link and save as) and upload it into your new server, in the same place you dragged all your files earlier. Then open the file in your web browser by doing something like GeekRev.com/phpinfo.php – changing GeekRev.com to your site’s name.

Once  this page opens, look for the following entry: DOCUMENT_ROOT. The value associated with this entry is the internal path to where your files are located on your server. In my the value was something like: “user/home/geekrev2/” – use this value in the plugins that need it. For instance, for the DBC Backup 2 plugin, I had to tell it to backup to “user/home/geekrev2/wp-backups/” for it to work.

All done.

Your mileage may vary, and I explicitly state that if you follow my instructions at your own risk and that I am not responsible for any issues you might have, and I am not responsible for fixing them either. But, that’s all I had to do, and it worked without a flaw for me. There are many other ways to accomplish what I did here, but to me, this is the simplest way to get things moved, using as few steps as possible.

 

herbhalstead

Posts Twitter Facebook

Herb is the lead pastor at Thrive Church. Herb also does freelance web design, 3D architectural modeling, and works as an architectural designer.

2 responses to How to Move Your Website To a New Host/Server

  1. How to Move Your Website To a New Host/Server http://t.co/Xz4y73Tp

  2. How to Move Your Website To a New Host/Server http://t.co/IN1nvBiw @geekrevdotcom | Helpful post if you’re thinking about making a change!

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*

Don't have a Gravatar? Get one!

Have you Subscribed via RSS yet? Don't miss a post!