Home » Internet » Blogging » How to migrate your WordPress blog to another domain name with a new host

How to migrate your WordPress blog to another domain name with a new host



Do you want to migrate your WordPress blog to another domain name and now that you’re doing it you would also like to change your crappy host? It is totally understandable. When you started your blog you never knew what direction it would take. You may have changed the topic or you must have seriously gotten into some killer blogging and are now looking for a really professional domain name to support your blog. Migrating your WordPress blog to another domain name and a new host can be a problem but it can be really easy: depends on your experience and your comfort level with doing lots of things and keeping track of them.

Listed below are a few steps that you can go through in order to migrate your WordPress blog to another domain name.

Register the new domain name and get it hosted with the new web host

This doesn’t need to be specified but it is a very important step. Before you can start transferring or migrating your WordPress blog you must have the new domain functioning and this means when you type its URL something must come up instead of “this domain is not available yet” or something to this extent.

You may also like to upload a robot.txt file with the following lines to your new blog root directory:

User-agent: *
Disallow: /

This way while you are installing or migrating stuff both the search engine crawlers and human visitors won’t find missing and confusing information on it. Your blog should be fully available only when it is properly set up.

Install WordPress on to the new domain name

Before uploading your WordPress files, aside from entering database information, you may also like to enter the following lines into your wp-config.php file:

define(‘WP_SITEURL’, ‘http://newblog.com’);
define(‘WP_HOME’, ‘http://newblog.com’);

This tells WordPress what base URL must be used for this particular blog.

Again, before you can migrate your old WordPress blog to this new domain you need WordPress running on this server. Some advice you simply download all your files from your old host and then upload them to your new host, I suggest you install a fresh copy of WordPress. It may require a few more steps but in case there were some problems with your older blog set up you won’t be carrying them forward to your new blog. So upload the latest WordPress files and set up the blog. Don’t worry about naming it or other stuff, simply have something you can upload your old content onto.

Download your custom files from your older host

Normally you only need to download the wp-content folder because it basically contains everything you have personally done with your blog in order to make it look the way it does right now. It should contain all the images that you uploaded while publishing blog posts. It also contains the WordPress theme that you are currently using.

If you want to do it right now, upload this folder to your new WordPress blog on the new host in the same folder you have installed the WordPress files.

In case you have been saving your images in another folder you may like to download that folder too.

And now that you’re at it you may also log into your new WordPress blog and set the theme as the one you have been using so far.

Take XML backup of your blog from the older domain name

Some people may suggest you to go to the phpMyAdmin interface and play around with MySQL in order to generate an SQL file for the backup. This might be a good idea if there aren’t many blog posts under your blog but a slightly bigger file may cause problems for you. So it is better to use the function already built into the dashboard (or you may have to install a plug-in for this: WordPress will automatically ask for it if you haven’t already installed it). On the left hand side toolbar (once you are inside the dashboard) click “Tools” and then “Export”. Using this interface you can easily generate an XML file and store it somewhere on your computer.

Import the XML backup into your new blog setup

Log back into the WordPress setup of your new domain. Go to the dashboard, again click “Tools” and then “Import”. After this it is very easy to import the XML file that is already there on your computer. Just a couple of clicks should enable you to import all your blog posts, pages and comments. You can attribute your blog posts and pages to a new author or you can use the existing author.

Replace instances of the old domain name in the database

In many of the WordPress database tables there may exist instances of your old domain name that you would like to change to your new domain name. You can access the phpmyadmin section of your new web host and run an SQL query to replace the occurrences of old domain URL to the new domain URL but if you’re not comfortable running SQL queries this is the plug-in you can install and achieve the same task. This will help you search and replace strings in the database.

Use 301 redirection to redirect all the old blog posts to the new domain

Although you have migrated your WordPress blog to another domain name and a new host most of the people and even the search engine indexes won’t know that. For a long time traffic will keep coming in to your old domain. You have to redirect this traffic without causing confusion. People and crawlers trying to access a particular blog post should be able to access it in the same manner but from the new domain. For instance all the traffic to http://oldblog.com/this-blog-post should be redirected to http://newblog.com/this-blog-post

You can easily achieve this with 301 redirection. All you have to do is include the following line in your .htaccess file:

Redirect 301 / http://newblog.com/

That completes all the steps you require to migrate your WordPress blog to another domain name with a new host.