[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.





4 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
- wordpress?copy | Google analytics, ??????
[Click to close]31 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
Matteo Reply:
September 30th, 2009 at 4:44 am
Are you using a prefix to the tables? es: INSERT INTO `prefix_wp_options` VALUES
Hope this would help you.
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
Damien Reply:
July 5th, 2009 at 2:17 am
If you are changing web host, perhaps you can ask them for help. Some web hosts help their client to migrate to the new server for free.
Reply
Thanks for a good tutorial.
Reply
Hi,
Thanks for the tutorial. After I uploaded the site and database as described, I was able to get into the wp-admin and see the homepage of the site. However, I wasn’t able to see any other page, getting an error 404.
I did a global search and replace for the URL but that didn’t help either. Any idea if I’m missing a step?
Thanks,
Antonella
Reply
Jun Reply:
September 15th, 2009 at 3:40 pm
Hi,
i got the same problem as you had. After that, i try to update the database as referenced on line:
http://www.mydigitallife.info/2007/10/01/how-to-move-wordpress-blog-to-new-domain-or-location/
however, it still doesnt make any change.
Did you solved the problem? anything new?
Good luck
Jun
Reply
I was trying to migrate my blog to a subfolder of a new domain(www.olddomain.com to http://www.newdomain.com/abc) and got the same problem as Antonella had. The main page was all right, however, lost all those links.
Can someone give some hink what i did wrong?
Thanks
Jun
Reply
Damien Reply:
September 20th, 2009 at 9:07 am
1) Log into your phpMyAdmin.
2) Locate the database for the current site
3) Click on the table wp_options
4) Locate the fields: siteurl and home
5) Change their value to the URL of the new site.
6) Save and exit.
Reply
Many thanks for this! Very useful indeed!
Reply
Hi, great guide. It worded for us easy! However, we’re facing a issue I cant figure out.
After the export/import, the install seems to have partially lost control over the existing directory structure (wp-content). The permissions are set correctly; media assets which were present before the exp/imp can be removed/ new ones added; plugins and themes can be added and removed. However, themes, plugins or directories present prior to the cloning process, seem to be beyond the control of the server.
Specs:
iis7 (I’m pretty sure)
mysql (latest)
wp 2.8
Thanks for any help
Keir
Reply
Be careful to configure the sql file correctly…
They don’t mention this, but you also have to configure your uploads path, I couldn’t upload files because I hadn’t changed it.
Look for INSERT INTO `wp_options` VALUES (59, 0, ‘upload_path’,’ yourpath ‘,’yes’)
and modify it to your new uploading path
Reply
Keir Reply:
November 10th, 2009 at 6:34 am
Thnx, thats a good point. Will keep in mind.
My problem boiled down to something much stupider:
was giving ‘iis_user’ WRX permission rather than ‘i_user’… on the MS server…
Daft.
Solved.
Reply