I have a preferred methodology when it comes to migrating a WordPress site from one hosting company to another. If you’re planning to move your site from one hosting company to another, whether it be because of reliability or cost issues, then this post is for you. If you plan to move your WordPress.com blog to self-hosted platform, click here for instructions. This guide is for those that wants to migrate their blog to another hosting company. Before you start moving your blog to another hosting company, you should also consider switching to managed WordPress hosting providers. They can easily migrate your website and generally do it for free. Even your new hosting provider could transfer your WordPress blog for free. It is a good idea to ask them before you start doing technical staff on your own.
Things to Do Before You Start migrating your WordPress blog
There are several things you should do before you even begin migrating between hosting companies. You need to note a few numbers to make sure the process of migrating your WordPress site was completely successful. These are the details you should take note of:
- Take note of the number of blog posts you have, as well as the number of comments, pages, and categories your site has. You can easily collect this information from the WordPress dashboard.
- Take note of the widgets and codes you are using on your site to make sure you don’t lose any of them as you move your site to another hosting company.
- Make sure to take screen dumps of important pages on your site to make sure everything was successfully migrated.
Once you’ve done the steps outlined above, it’s time to migrate your site.
Step 1: Cease Any and All Activities on your Old Hosting Provider
Do not post or edit anything in your website until you finish moving your site to your new hosting provider, as you risk losing data by doing so. This is particularly important especially if your site is set up with several writers in it.
Step 2: Create a New Database on your New Hosting Provider
The first thing you need to do is to create a new, blank database with your new hosting provider. Almost all hosting companies have a database creation wizard which will guide you through the setup process. Make sure you have your new, blank database so it will be ready to accept your new data.
You will also need to note the database details such as the database name, username, password and host as you will need these information later when you update your wp-config.php file.
Step 3: Create a Backup of your Database
Look for a tool called phpmyadmin in your old hosting company; almost every hosting provider has this tool. What phpmyadmin does is it will create a dump for your database. Go to where it says export and make sure you select all of the tables and then create a dump file. Save this file in your computer. You can read more about backup and recovery from this post.
Step 4: Copy all of your WordPress Files via FTP
Using FTP (or sFTP to make sure your site is secure), connect to your old hosting site and download a copy of all of your files from your site to your computer. This process might take a while depending on how many files you have on your site. If you have a lot of files, expect that this process can take hours.
Step 5: Upload your Database to the New Hosting Company
Connect to your new database through phpmyadmin and then start an import process. If you run into any issues, don’t worry. Keep in mind that your site is still active on your old hosting provider. You can take your time and learn as much as you can with the import process. When you’re confident to continue, you can begin the process anytime.
Step 6: Upload Your WordPress Files
This step is actually the reverse of step 4. You’ll need to use FTP to copy all of the files you saved from your computer to your new hosting provider.
These files should be copied into your http root. Check with your hosting company to make sure, but it is usually called www. or public_html.
Step 7: Edit your wp-config.php File
Edit your wp-config file and change the configuration so that your WordPress site will now point to your new database, as created in step 2. Below are the things you will need to change:
“/** The name of the database for WordPress */
define(‘DB_NAME’, ‘new db name‘);
/** MySQL database username */
define(‘DB_USER’, ‘new db user‘);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘new db password‘);
/** MySQL hostname */
define(‘DB_HOST’, ‘new db host‘);
Relax and Take a Deep Breath
We have now reached a point where you will be moving your domain, and it can be quite scary. If you made any mistakes during the migration process, your site will crash and you will be left with an incomplete WordPress migration.
Test Before Migrating
Find out if your hosting provider offers a temporary URL (like the one GoDaddy does). If they do, add the following two lines into your wp-config.php and then set the URLs to the temporary URL. What this does is it allows you to test your configuration before you migrate your domain name.
Make sure you remove these two lines once you’ve tested it.
Step 9: Migrating Your Domain Name
Will you be moving your domain name to your new hosting provider, or will you just point it to the new hosting? Here are a few ways you can migrate your domain.
Changing Name Servers
This is actually the easiest way you can migrate your domain name. Sadly, I cannot give specific instructions on how to proceed with this because every hosting company does this in a different way. However, here is a general idea on how the process works:
- Obtain the new name servers from your new hosting company. These usually are ns1.newhosting.com and ns2.newhosting.com
- Go back to your old hosting provider and update the name server option.
- Domain replication will occur but it can take up to 24 hours before the name servers are actually updated.
The good thing about updating name servers is that it leaves your domain registration with your old hosting provider and it only points to a new hosting location. If you want to migrate both your hosting and your domain registration, you should follow the next step below.
Migrating Your Domain to your New Hosting Provider (a little complex)
This is actually a more time consuming and complex way to move your domain and domain registration. As mentioned earlier, the steps in doing so are different from one hosting company to another, so be sure to check their FAQs or documentation for more information.
- Inform your new hosting company that you are going to transfer a new domain into your account.
- Be sure the domain you are going to transfer is unlocked from your old hosting provider (check your old hosting provider’s documentation for this).
- You will then be given a set of migration codes, and you will need to enter these codes in the domain console as instructed.
- The migration process has now begun and the domain has been moved to your new hosting account, and it now points to the database/files you moved.
Transferring domains can take days, so it is highly recommended to take a mixed approach f moving the name servers and then moving the domain registration.
This is quite common, and your hosting provider will be able to help you with it.
Step 10: Test and Re-Test Thoroughly
Your website should now be live on your new hosting account, and it is now time to test it.
Check if the number of pages, posts, comments, etc. are the same from the information you noted before you began the migrating process.
You should also test the following:
- Add a new post (a test post)
- Upload a new image
- Check and see if the images you inserted can be viewed in your posts
- Check if the sidebar works
Things to Look Out For
It’s possible that your upload path will be hard coded with a directory that isn’t present with your new hosting provider. If this is so, you will not be able to upload files, and your site may have problems displaying images.
In order to check and see if this will be a problem, go to Settings, Miscellaneous, and check if you see an entry with a long path instead of wp-content/uploads. If you do, you may have an issue, so you should set it to the default wp-content/uploads.
Another problem you might encounter is with the .htaccess files and your permalinks. If your homepage works but your posts and pages get a 404 error, you will need to re-create your permalinks by going to Settings and then Permalinks.
A Few Final Words
Moving your WordPress site from one hosting account to the other is not the easiest thing to do. You should take some time in doing so and make sure you are following all of the necessary steps in order to successfully migrate your WordPress site.