Howto Move WordPress To New Host
In this post i want to share a details on how to move WordPress to new host, Hostgator in this specific case, with 0 down time. Information provided is based on my recent personal experience of relocating my WordPress blog from Site5 hosting account to Hostgator and ensuring that I had no outage period and yet was able to verify that entire process worked without a glitch.
There are several steps to this process and each requires verification to ensure that everything will function properly but once you get them all right – you will ensure that your visitors will not be impacted during your move and if you rely on your blog as income source, I think it is very important. Not only does it allow your to reduce any nuisance but also avoid unprofessional appearance during your move of WordPress blog to new host.
Since I’ll be covering this process based on my personal experience I want to describe the conditions under which relocate of my blog was completed, so you can quickly evaluate if this will apply to your specific situation or not. If it doesn’t I provide several links within the article that describe slightly different procedures to move WordPress blog to new host:
- All my domains registered and maintained at NoMessDNS.com
- Old WordPress blog was hosted on Site5 as one of the primary domains
- New location for my WordPress Web 2.0 Guide blog is on Hostgator as an Addon Domain
Entire process will be split into several parts to make it least painful and most rewarding…
Step 1: Create a Complete Backup of Your WordPress Blog
This step is what will ensure that we have all the files we need to migrate our blog to new host.
1. Create backup of your files.
Using your favorite FTP client connect to your old host and download ALL files contained within your blog directory. Make sure you don’t miss hidden files such as .htaccess. If you have any plugins that required from you setting specific permissions to files or folders be sure to go through the structure of your blog and record those special permissions. Generally it would encompass applying a less restrictive permissions on files or folders within
I recommend you simply document the permissions you currently have or what is even better open an installation documents for plugins that required those permissions. It is common for hosts to have inconsistencies as to what permissions will be enough to have that specific plugin running and your new host might not require changing permissions to 777 or whatever specified. Having correct installation files will help you later to troubleshoot any issues with plugins.
I personally use Filezilla free ftp client that provides all the options I need and gives me ability to traverse directories and change/record permissions as needed.
2. Create a Backup of Your Database
I have no intentions to complicate this process and simplest possible way to get a complete database file you need is simply using a Backup option provided by your host. In my case I simply download the *.sql.tgz file with complete blog database backup using backup option and then open and verify that data within the file is not corrupted. The database backup file can be viewed with any text editor and I use a Notepad provided with Windows.
Couple things you have to be aware of if your blog is old or has a lot of data in database as well as media files. You might not be able to use standard methods for backing up I describe here. Due to large files sizes your browser window will time out before you manage to get good backup files. Specifically if your database is large. If this applies to your blog I recommend you read this great article that describes how to use SSH to perform the move of WordPress to new host and does require some Unix/Linux shell knowledge (at least basic) :
Step 2: Setup Your DNS Server Records To Point to BOTH Hosts
This step is a temporary solution to ensure that we can install our blog on new host (Hostgator) and verify that it functions properly and ensures that your visitors will not see any interruption of service. If you are not sure how to do it – Hostgator has a number of video tutorials showing how to use multiple DNS registrars to setup their DNS servers. Please review what is appropriate to you or at least to get an idea of what we will be doing.
One thing we will do different is number of servers we will setup!
And don’t worry – it will not break your existing blog but required to have 2 copies of our blog running simultaneously on different hosts until we are ready to pull the plug on old host. By default Primary DNS (which points to your old host still) server will be queried by any client and once name resolution received no further queries will be done but the Hostgator host will see that their servers are also present and will allow you to create Addon Domain on your account.
Login to your registrar and ADD (not replace) 2 new DNS servers to your blog domain. Your host should have emailed you with this info during main account setup. Hostgator uses these servers: ns1.hostgator.com and ns2.hostgator.com. So all I had to do is add those 2 servers to my howtospoter.com DNS servers list in NameSecure account management.
Step 3: Create New Addon Domain And Upload Our Blog
Since we still have our blog running on old host and we added Hostgator DNS servers to domain name registrar we should be ready to go with this step without impacting visitors. It might take a few hours for the DNS change to take effect, in my case it took about 1 hour. If hostgator doesn’t see its servers listed for resolution of domain name – it will simply give you error when you try to add new Addon Domain. So, simply give it some more time and try again.
1. Add a new domain to Hostgator
To add your new blog domain to Hostgator simply proceed to cPanel and then click on Addon Domains option. You will be presented with a screen as shown below. Fill in your information and click Add Domain. Few things of note:
Username field will be a directory within public_html where you place your new blog and also a User with access to that domain via cPanel or FTP, when needed. Password is used for that user authentication, so make it strong and not as I have shown below:
If your DNS servers information propagated and Hostgator sees its servers in the list – you will get a success message otherwise simply wait and try again in an hour.
2. Upload your blog files to newly created domain
- Once your new domain created on Hostgator simply upload your blog files to the directory created in previous part. As shown in picture it would be /public_html/yourblogdomain/ . This becomes root folder of our new blog.
- Create a new database and user with access to it using MySQL Databases Tool in your cPanel. Record database, username and password information from this step. Open phpMyAdmin tool and click on new database you just created. Use Import tab and navigate to your database backup file and import the data into your new database. Now your database should have all the tables and information in it for your blog.
- Navigate to /public_html/yourblogdomain/ and open wp-config.php file for editing. Change the information to point to your newly created database. Save file and exit.
Now that your blog is restored to new host you need to verify that it actually works properly…
3. Verify Your Blog Functionality on New Host
First thing you need to do is to look in your cPanel and find out exact IP of the server where your blog is located. See image below (I have removed some info for privacy). As you see below, my IP is 74.53.28.***. For the sake of this exercise I will make it 188.8.131.52.
Now that we have our host IP address we need to force our Windows computer to direct ALL queries for yourblogdomain.com to go to 184.108.40.206.
Navigate to location (1) and open hosts (2) file for editing with Notepad. On New line enter IP address, then hit space bar and then your blog domain name (3). Use Cotrol+S to save file (Do Not SAVE it with any extensions) See image below:
Once your file is saved use a Command line utility and ping yourblogdomain.com:
You should get:
C:\Documents and Settings\You>ping yourblogdomain.com
Pinging yourblogdomain.com [220.127.116.11] with 32 bytes of data:
Reply from 18.104.22.168: bytes=32 time=47ms TTL=53
Reply from 22.214.171.124: bytes=32 time=46ms TTL=53
This is obviously a fake domain and you will have to substitute it with yours but what is most important is this: Pinging yourblogdomain.com [126.96.36.199] should correspond to changes we made in hosts file!
Once this works – login to your blog admin interface (now on Hostgator) and make sure all plugins working, everything looks good on front end. Edit any plugins permissions if not working correctly. Basically verify that your blog on new host functions as designed and no errors present on Front end or back end.
Step 3: Pull the Plug On Old Host!
- Once you have verified that your blog works properly on your new host revisit your domain registrar and remove DNS servers for old host. From this point you should have there only 2 DNS servers defined by Hostgator (or whatever your host is). Save your changes.
- Edit your hosts file and remove static domain name resolution by either deleting the entry you have created or by placing a # sign in front of it. Use Ctr+S to save the changes to file.
- Use a ping utility and make sure that Dynamic Domain Name Resolution point to your new host. Please note that it might take up to 48 hours for the changes made to DNS servers in your registrar to propagate through internet. That is why we leave 2 copies of your blog running for this time.
In my experience it only takes couple hours for the DNS changes to propagate but to be on safe side I wouldn’t post anything for at least a day (give yourself a break, you know you deserve it!). Once you are sure that your blog is safely located on new hosts and all visitors access it and NOT old blog you can resume your normal posting and delete account on old host.
If this article didn’t help you, here are other articles that cover it in a different way:
Don’t have a good new hosting? I use and recommend Hostgator!blog, hostgator, hosting, howto, howto-guides, WordPress