[Hacking WordPress]: How To Clone And Migrate Your WordPress Blog To New Server
In 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:
- Download the wp-db-backup plugin.
- Upload to your existing server and activate it via the ‘Plugins‘ menu.
- 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.
- In your computer, extract the gzip backup file. You should now have a sql file.
- 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 URLNext, 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. - 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.
- Log in to the PhpMyAdmin in the new server (here is the instruction to access your PhpMyAdmin)
- Create a new database for your wordpress and import the sql file to the database
- Change the database configuration in the wp-config file in the WordPress folder that you have downloaded
- 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.
- Download the bigdump file from here (This is a customised version that I have modified to work with wordpress blog)
- Unzip the file.
- In the ‘restore‘ folder, open up config.php and change the database configuration.
- Copy and paste the sql file into the folder.
- Upload the ‘restore‘ folder to your new web URL
- On your browser, navigate to the url http://your-new-web-url.com/restore/bigdump.php
- Click on the “Start import” to import the sql file to the database
- Once completed, upload the whole WordPress folder to your new web server.
Done.
Enjoyed the article? Subscribe to Make Tech Easier today to get your daily updates of technology tutorials, tips and tricks.




3 pingbacks/trackbacks (Click to open)
- Interesting Posts Around the Web - Feb 11 | Interesting Observations
- Mudanza del blog | Thuer.com.ar
- Metal Martian » this is a test
[Click to close]20 Responses
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.
Reply
@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.
Reply
Alternatively you can use the export and import function already built into Wordpress without having to install any additional modules.
Reply
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
Reply
@oscarlopez: Did you use the wp-db-backup plugin? The above technique should work in WP2.6 as well.
Reply
hi yes i did…but i can´t find this in the sql..
Reply
@oscarlopez: Which version of wordpress are you importing from?
Reply
2,6
Reply
Hello Damien, I think this is a good tutorial for this kind of issue, but I wonder if the special characters get lost in spanish blogs, for example the ñ and accented characters ?
Reply
What about the URLs contained in the INSERT INTO wp_posts fields?
Reply
@jeremym:The URL displayed on the address bar is based on the premalink structure that you configured within your WP admin page. The URL contained in the wp_posts field will not affect the actual URL displayed.
Reply
Thanks a lot for this tutorial I think it was very helpful ..
Reply
Hi Damien
Great tutorial. I’m testing it now, but I did notice that there is a line:
INSERT INTO `wp_options` VALUES (60, 0, ‘upload_path’,
and that line contains the server path to my uploads folder.
Assuming I’m cloning the installation to another domain, won’t I need to change that to match the new server path?
Also I can see my URL in multiple additional places:
INSERT INTO `wp_options` VALUES (85, 0, ‘dashboard_widget_options’,
In 2 or 3 places regarding Google Blogsearch.
INSERT INTO `wp_options` VALUES (90,
that looks like it’s something to do with recent RSS feeds on the Dashboard?
INSERT INTO `wp_options` VALUES (100,
which look like my FTP settings
and
INSERT INTO `wp_options` VALUES (132, 0, ’sociable_conditionals’
(Something to do with the Sociable plugin?)
Wouldn’t these all have to be changed accordingly?
Cheers
Nick
P.S. If you email me at the address I’ve used to post this comment, I can email you a copy of the SQL dump file so you can see for yourself.
Reply
Won’t the guid values of the posts in the remote database need to be changed, or is this covered by your reply above that the URL on the address bar of the remote weblog is determined by the permalink?
Reply
Damien, thanks so much for this tutorial. It allowed me to migrate my Wordpress site in less than 10 minutes! Thanks for saving me all the hard work of trying to figure this out myself!
Best Regards,
-Jay
Reply
HORE!!! This tutorial is done!!
now i have a good blog, you can see http://www.areaofgames.wordpress.com
i cloned it from my suck friends http://www.radioactivemonkey.wordpress.com
Reply
Good tutorial, but lacking some key points, and thence somewhat sloppy. Why even post an article like this if you aren’t going to follow up and answer questions? I don’t get it.
Key points left out by the hasty author:
1. You won’t see “INSERT INTO `wp_options` VALUES (1, 0, ’siteurl’” Instead you will see something like “INSERT INTO `wp_y6hww3_options` VALUES (1, 0, ‘http://www.yoursitename.com’”
2. There will be multiple references to your old domain in the SQL file. Just do a global search and replace.
3. In your wp-config file, the author generalizes and says “Change the database configuration in the wp-config file in the WordPress folder that you have downloaded” Change what? You need to change the user name and password to whatever your NEW database user name and password are AND the name of the database you created.
I will post a much better version of this tutorial on my site soon and report back.
Nice try here, but again, in the end it is incomplete
Reply
Many thanks for this.
Some comments above indicate that a few points are missing or not very clearly explained, but I had no idea how to clone my site & with the article above I managed to clone & migrate my site to a new URL, so many thanks for a very informative post.
Reply
I’m with Dave on this one; if we add comments where there are issues, the “incomplete” post turns into “a good start” with some good notes! So here’s mine.
Instead of updating the database manually to change the URL, you can change options in the wp-config.php file; there’s one for wp_siteurl and one for wp_home, documented here on the WordPress site. These don’t actually change the database values, but once the site is moved over, you can change them through the usual settings page (then take them out of wp_config.php).
Reply
For those of us with less time and technical experience, is there a fast and reliable 3rd party or company that can do migrations of entire site + wordpress?
Reply