blog-move.jpg

Credit : Moving tip# 28

Few posts back, I’d mentioned that how one can move the WordPress blog from one web-host to another in one of the simple ways. However, there is one more simple and quick way of moving the WordPress blog and I would like to share it with you all to ensure that in case you face the problem of changing the host then you won’t have to waste enough time in the process and that you concentrate more on writing.

Easiest and quickest way of moving WordPress blog from one web host to another:

Prerequisites of the whole process -

1. SSH should be enabled on both the webhosting accounts.
2. Access to phpMyAdmin on both the accounts.
3. SSH Client – For windows you can check the list of SSH Clients from here. Linux and Mac users can live with plain ol’ Terminal.
4. FTP access (not required though as such)

Important Assumptions -

1. domain of blog we are moving : http://mayank.info
2. Old Host’s folder structure – /public_html/mayank/
3. New Host’s folder structure – /www/blog/
4. Username/Password on Old host – admin/pass123
5. Username/Password on New host – newadm/newpass1
6. SSH address of the old host – 202.34.15.23
6. SSH address of the new host – 202.54.65.111

The Process -

1. Making the backup : The first step is to ensure that we make the backup of all the files and for that we will use the SSH of the original web host and will navigate to the folder where wordpress is installed and will run these commands to do make the back up of the files – Type the following commands in the SSH client.

  • ssh admin@202.34.15.23 (this will connect you to the old server, when you’ll press enter after this command, it will ask for the password, just enter the SSH password which in our dummy case is pass123)
  • cd public_html/mayank (this commands will bring you to that particular directory where wordpress is installed on our old host)
  • tar -cvf wholeblog.tar ./ (this will ensure that all the files in the folder called mayank gets packed in a file called wholeblog.tar)
  • exit (this will disconnect you from the old server)

2. Moving the backup to new server : Now that we have created the backup, it’s time to move the back up to the new server and unpack it too. For that we’ll follow these steps -

  • ssh newadm@202.54.65.111 (again this will connect you to the new server)
  • cd /www/blog (this takes us to the folder where we’ll move the blog).
  • wget http://mayank.info/wholeblog.tar (this will fetch the file from the old host to the new host)
  • tar -xvf wholeblog.tar (this will unpack the file and all the files will appear just the way they were on old host).

3. Make the changes in wp-config file – Now that we have unpacked all the files, we will make the changes in the wp-config file to ensure that it points to the new database location. We’ll need to change the username, password & the database server information. It’s similar to the way we install the new wordpress. Although, we’ll make the changes directly through SSH Client with the help of these commands -

  • sudo nano wp-config.php (this will open the editor called nano and you’ll be able to see the content of wp-config.php in it.
  • Make the required changes i.e. database username, password & database location and save and exit.
  • exit (this will disconnect you from the server).

Note : If you are not comfortable enough with Nano editor then the alternate to this can be that you connect with FTP of your new server, download the wp-config.php file, edit the file and then re-upload it.

4. Making the database backup – It’s the time to make the back up of the database and I’ve not seen any better guide than the one mentioned at WordPress Codex. It tells you all the possible ways of making the backup. Although, I will suggest that you should follow the phpMyAdmin section in this guide.

5. Change the nameservers : Now is the time to change the nameservers. So point the nameserver of your domain to your new webhost.

6. Restoring the database backup – Again, I would refer you to the WordPress codex as it has a very good information on restoring the database backup through various ways.

7. DNS Propagation – It usually takes around 24 hrs. for the DNS propagation to be complete and you’ll be able to see your blog up and running and that in exactly the way it was before on the old host.

11 Comment

Featured Designs

Parent Society

Parent Society

Marijuana Maps

Marijuana Maps

Cake Journal

Cake Journal

CopyKat Recipes

CopyKat Recipes

Jessica Denay

Jessica Denay

Keith Ferrazzi

Keith Ferrazzi

Rennaissance Yoga

Rennaissance Yoga

Brink Zone

Brink Zone

Illustrious Author

Illustrious Author

Boca Care

Boca Care

KingsCast

Kingscast

Notecook

Note Cook

My Business Musings

My Business Musings

11 Responses so far | Have Your Say!

  1. Its a simpler method,but I think this is for advanced users.

  2. @Nirmal : I know it’s slightly techie and that’s the reason I wanted to cover the techiest part of this tutorial in details. What do you think , was i able to do a good job ? Or do you think it needs improvement in some ways?

  3. The other post has helped me move my blog to new host. This looks as much better way. Will experiment on some ones blog. Thanks for the info.

  4. The post is a good one, I’ll try when moving to VPS.

  5. Err not easy, don’t even know what SSH means and the link left me no wiser. I need to move 2 self hosted blogs to new hosts soon and am worried that I will lose all of my work. Willing to pay a reasonable amount for help.

  6. Clever! I’ve bookmarked this post for my future reference. :)

    You can also have a zero downtime if during DNS Propagation if you know the tricks. Just don’t close your old host yet, make sure both old and new host has the same files and filepath (including database), and do your nameserver changes on your registrar to your new host without closing your old account first (which you can do it later when it has been fully propagated). The switch from old -> new host will be done seamlessly.

    But make sure don’t post anything on your blog on the Propagation date to prevent losing your new posts. :)

  7. What about using full backup / restore function in Cpanel to move wordpress from old to new host of course if the both web hosts have Cpanel ( mostly have )

    Does anyone try this method ?

  8. thanks for sharing this info. found it really valuable.

  9. What a great guide,I have a wordpress site,this is a goldmine for saving alot time and hassle.Thought I’d have basically rebuild the site,many thanks for this.

  10. Very nice tutorial. I spend hours to find the solution and you make it looks easy to do.
    Thanks for helping us.

Trackbacks/Pingbacks