Post

[Hacking WordPress]: How To Clone And Migrate Your WordPress Blog To New Server

wordpress logoIn the event that you need to migrate your current WordPress blog to a new server, or a new URL, the last thing that you want to do is to reinstall WordPress on your new server and reconfigure the setting all over again.

While you can use the export/import function under the ‘Manage‘ menu to migrate your database over, it is definitely not the best and ideal solution, especially if you have a huge database. In addition, if any of your plugins created their own databases, they aren’t going to be migrated by the export/import function.

To migrate your WordPress blog, the best and the easiest way is to clone it and plug it into the new server. Since WordPress is a database driven platform where all its configuration settings are kept in the database, we can achieve a cloning effect simply by backing up all its database tables (including those created by the plugins) and dump it into the new server database. There is no need for reinstallation or reconfiguration.

Here’s how you can clone and migrate your WordPress blog to a new server in 10 steps:

  1. Download the wp-db-backup plugin.
  2. Upload to your existing server and activate it via the ‘Plugins‘ menu.
  3. Go to the ‘Manage‘ -> ‘Backup‘ menu. Select all the tables (including those tables created by the plugins) and click the Backup button to download the gzip file to your computer.
  4. In your computer, extract the gzip backup file. You should now have a sql file.
  5. Open the sql file with a text editor. Search for the line

    INSERT INTO `wp_options` VALUES (1, 0, 'siteurl'

    You should see something of this format:

    INSERT INTO `wp_options` VALUES (1, 0, 'siteurl', 'http://www.your-old-url.com', 'yes')
    Replace the URL with your new server URL

    Next, search for the line

    INSERT INTO `wp_options` VALUES (39, 0, 'home',

    You should see
    INSERT INTO `wp_options` VALUES (39, 0, 'home', 'http://www.your-old-url.com', 'yes')
    Replace the url with your new URL. Save and exit.

  6. Using a FTP program, download the whole WordPress folder from your current server to your computer. Keep the folder structure intact, especially the wp-content folder.
  7. Log in to the PhpMyAdmin in the new server (here is the instruction to access your PhpMyAdmin)
  8. Create a new database for your wordpress and import the sql file to the database
  9. Change the database configuration in the wp-config file in the WordPress folder that you have downloaded
  10. Upload the whole WordPress folder to the new server.

Done. You can now proceed to your wp-login page at the new server and login with the same username and password. All the configuration and settings will be the same as before.

If your WordPress database (the sql file you have created) is more than 2MB, the above method might not work since PhpMyAdmin only allows a maximum of 2MB file import.

To overcome this, you can use bigdump to dump the sql file to your new database.

  1. Download the bigdump file from here (This is a customised version that I have modified to work with wordpress blog)
  2. Unzip the file.
  3. In the ‘restore‘ folder, open up config.php and change the database configuration.
  4. Copy and paste the sql file into the folder.
  5. Upload the ‘restore‘ folder to your new web URL
  6. On your browser, navigate to the url http://your-new-web-url.com/restore/bigdump.php
  7. Click on the “Start import” to import the sql file to the database
  8. Once completed, upload the whole WordPress folder to your new web server.

Done.

For more technology news, tips and tricks, subscribe to Make Tech Easier today.

Popularity: 10% [?]

StumbleUpon It!

 

9 Comments Received

 
January 30th, 2008 @3:42 pm  

Thanks for the useful information. Too bad there isn’t a good way to transfer backlinks when you move to a server with a different domain name.

January 31st, 2008 @2:14 am  

@Mary: A good way to bring the backlinks along with you is to place a Redirect 301 on your old server, pointing to your new site. Though the backlinks won’t show in your blog, but the traffic will still reach your new site.

February 11th, 2008 @6:54 am  

[...] Clone and Migrate WordPress Blog to New Server @ Make Tech Easier [...]

February 13th, 2008 @12:22 pm  

Alternatively you can use the export and import function already built into Wordpress without having to install any additional modules.

August 9th, 2008 @4:49 pm  

hello i don´t seem to find
INSERT INTO `wp_options` VALUES (1, 0, ’siteurl’ nor
INSERT INTO `wp_options` VALUES (39, 0, ‘home’, in my sql can u tell me why? i´m useing wp 2,6 version

August 10th, 2008 @7:48 am  

@oscarlopez: Did you use the wp-db-backup plugin? The above technique should work in WP2.6 as well.

August 11th, 2008 @9:44 am  

hi yes i did…but i can´t find this in the sql..

August 11th, 2008 @10:11 am  

@oscarlopez: Which version of wordpress are you importing from?

August 11th, 2008 @10:40 am  

2,6

Leave A Reply

Please Note: Comments maybe under moderation after you submit your comments so there is no need to resubmit your comment again