How to Transfer Big WordPress Blogs to New Host in 20 Minutes

Note:

  • This tutorial is aimed at bigger wordpress blogs and for those hosted on VPS or dedicated servers.
  • This tutorial should not be tried if you are not familiar with basic Linux and MySQL commands on SSH.
  • This tutorial is just about transferring WordPress files and Databases only. Please be informed that server configuration and other things are not discussed in it.

There are various methods available for transferring hosted wordpress blogs from one host to another, with ease. But when it comes to bigger blogs with thousands of files, over hundred even thousands of MBs MySQL database – the process can become never ending and hectic, especially if you are on a slow internet connection.

I am going to tell you a way to shift your wordpress blog with ease, in just 20 minutes (we did it practically when we moved ProPakistani from VPS.net to Wiredtree.com)

Prerequisites

First of all make sure that your new VPS or dedicated server, with root access, has following applications installed:

  • PHP
  • MySQL
  • Apache or any other web server

Once you have these applications installed, make sure you have added your domain on this new web server. Adding a domain through cPanel is easy, if cPanel is not available – you might need to add a domain via SSH through this tutorial.

If you don’t know what SSH is then you shouldn’t be reading this tutorial, and ask someone to make this wordpress transfer work for you.

We are assuming that you have added your domain and at this point of time you are done with server configuration and all.

Time to shift your wordpress files and databases now.

Making a Backup of MySQL database with SSH

Before we transfer files, we need to take backup of MySQL database used for wordpress.

We are making backup file now because, we will shift this backup file to new host with all other files.

Login on old host with SSH, and use following command:

Command:

mysqldump -u username -p database_name > /home/propakistani/public_html/dumpfile.sql

Command explanation:

  • mysqldum: command name
  • username: your username for MySQL database
  • database_name: Database name used for this particular wordpress installation
  • /home/propakistani/public_html/: this is public directory or domain root on old host.

This command will make a backup file for your MySQL database and will place it in public directory.

Caution: This is a public directory on a webserver, so leaving this database backup file here for long can be risky.

Transferring Files:

  • login to your new host’s server, with SSH, go to your domain’s public directory,
  • In our case, ProPakistani’s public directory or domain root was: /home/propakistani/public_html
  • Now, you are all set to transfer files from old wordpress hosting to this current folder
  • Use following command.

scp -r user@oldhost:/home/username/public_html/ /

Command Explanation: In this example, command will transfer all files from your old host (/var/www/html) to local working directory, i.e. /home/propakistani/public_html

parameters used in command are:

  • user: this is the user name on old host, it can be root for instance
  • oldhost: you need to replace holdhost with the IP address of old host

After asking for password, this command will start copying all the files from old host to this new host. It can take time, depending on your files’ size.

We had 600 MBs of files with over 100 MBs of database, and it took us 15 minutes to transfer all files to new host.

File Transfer Done, now what?

Now, when all your files are transferred from old host to this current host, its time to import your database backup file. (which is also transferred to new host – remember, we took a back and had placed it in public directory). Now its time to use this file.

Importing MySQL Database using SSH

Tip:

we are assuming you have access to MySQL, preferably with same username/password as you had on previous host. This way, you don’t have to change anything in your wp-config.php file. If you have new username/password for MySQL, and new database name, change all the settings accordingly in wp-config.php.

Let’s start the import of MySQL database. We are assuming that your working directory is public_html, type following command in SSH

mysql -u username -p database_name < dumpfile.sql

Command Explanation:

  • username: MySQL Database username
  • database_name: MySQL database name
  • dumpfile.sql: Backup file for MySQL dump

And you are done!

Making sure everything is good:

At this point of time, you are done with transferring of WordPress files and databases to new host.

Let’s do the testing to make sure you have done it right. For this, we will access our wordpress blog from new host by adding IP address in windows Hosts file.

For the purpose, make a slight change in theme on new host, for instance, in the footer.php before </body> add this line “hosted on new Host” and save the file. This will help you identify if the files are served from new host or not.

Open notepad with administrative rights (you can do this with right clicking on notepad icon and selecting “run as administrator”)

  • Open this file: “C:\windows\system32\drivers\etc\hosts”
  • Type following in host file

your_new_host’s_IP Address yourdomain.com

your_new_host’s_IP Address www.yourdomain.com

in our case, it was like following:

173.199.131.188 propakistani.pk

173.199.131.188 www.propakistani.pk

Save this file and close it.

Now go to run, and type: ipconfig /flushdns

Now, open wordpress blog’s address in any browser, and bingo – check the footer, if it has “hosted on new Host” written, then you are being served from new host.

Possible Bugs:

  • You may need to CHMOD 777 to wp-content/uploads/ and other necessary files, for instance, cache folder created by wp-super-cache
  • You may need to change Database info in wp-config.php if username/passwords are not same on previous and new hosts
  • Your wp-super-cache will not work on new host, as the working directories will change. It is advised to completely un-install it and then re-install wp-super-cache to avoid any conflict.

Tech and telecom reporter for over 15 years


  • Thanks Aamir. Nice and simple explanation. Unfortunately I was having a lot of problems with my VPS provider which eventually lead to to switch to a better company. I was forced to move everything a couple of different times over the week or so. :)

  • How the hell this link is appearing on Google News Home Page under scientific category. This is no news…this is just an article like millions out there…SEO, a poor algorithm of news collection from google or what?

  • “You may need to CHMOD 777 to wp-content/uploads/”
    .
    chmod 777 … ???
    .
    kuch zyada nahi ho gaya? :P

      • I mean over-permissions..?
        Am sorry i just flied through the article if I mis-read something but isn’t it granting Full permissions to Everyone?
        .
        AM not familiar with webhosting but giving 777 rights could be dangerous..? why not 770?

        • webserver writes into this folder, hence 777 is required. This is a public folder in wordpress installation and stores attachments and files that appear in posts.

          • yeah i got a little idea of the nature of the directory by it’s name & location, hence got a little worried abt the 777 rights.
            Anyways, thanks for the clarification :) will look into it someday but let’s hope I never have to :p
            .
            .
            p.s is the directory on PP also 777’ed? :p just kidding…

            • I good way to transfer files is that simply zip the public_html folder and transfer it using wget or anything like this then unzip it on the new server it will not take more than 5 mins

  • Very nice article, i had to move a big site though it was not a blog but a forum, but i had to read a lots of articles to move.
    Thanks for the article.
    I guess propakitani.pk moved to a better server recently. Is it so?

  • Now then if you see new hosting provider and existing hosting provider free transfer from one host to another with any hosting package that your purchase with them. This will ease the time taken for us to migrate to new server.

  • bahi jan koi wordpress ka theme hi suggest ker do ya apnay theme ka name bata do :) search engine friendly or clear ho ?

    • Aamir bahi please koi acha seo k hisab sai wordpress ka simple theme bata do suggest ker do ,,,, koi direct link hi dina bahi ,,, siyasi biyan na dai dina :)

  • u said big wordpress blogs hosted on VPS..cant try this method for smaller blogs that are not on VPS and needs to be shifted on VPS
    Pls suggest

  • Pintwire offers Cheap Dedicated Server India, Fully Managed/Self Managed Servers, Weekly Backup, Linux/Windows Servers, 99.95% Uptime Guarantee, Full System Security, Managed Firewall. Customers are completely satisfied with 24×7 Customer Support in India.

  • I WAS SEARCHING FOR THIS FOR A LONG TIME AND YOU HAVE MADE MY WORK EASIER


  • Get Alerts

    Follow ProPakistani to get latest news and updates.


    ProPakistani Community

    Join the groups below to get latest news and updates.



    >