Copying a WordPress Blog to a Different Domain
Periodically I need to copy the contents of a log to another domain for testing purposes. WordPress doesn’t make this particularly easy as it embeds the complete URL of the site in many places, including the options table, in the posts table for each post, and even in posts, such as when media is added.
There is no need to create the blog in the new database. If you’ve already done that, I would recommend deleting the tables before continuing.
Before you move on, you’ll want to back up your blog. There are plenty of solutions for this, but a handy one that I’ve been using is WordPress Database Backup by Austin Matzko.
Now you can import the resulting backup file against the destination blog’s database. I use phpMyAdmin for this, so here are the steps for doing that:
- Log in to phpMyAdmin.
- Select the destination blog’s database.
- Click the Import tab.
- Click the Browse button and find the
.sqlfile that was the result of the backup operation. If your backup produces a.zipor.gzipfile, that will work fine also. - Click the Go button.
You now have your content over on the new site, but you still have work to do. You still need to change all references to the old domain to be the new domain. There are three SQL commands you need to execute to do this. To execute a SQL command, select the database in phpMyAdmin and click the SQL tab. Paste the following commands into the edit box and change old-domain and new-domain as appropriate. If you changed your table prefix, don’t forget to change the names of the tables as well.
First let’s fix the wp_options table.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
Now let’s fix the guid column in the wp_posts table.
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');
Finally let’s fix the content in the wp_posts table.
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
The final step will be to copy any files that were uploaded, such as in the wp-content\files directory.


I turned to the dark side at the end of February and purchased an iPhone. I am so very impressed with it! Since then I have moved to a new computer (a laptop) and reinstalled the operating system (Windows 7). That means I have had to move what I sync my iPhone with twice ,and both times have been a little less than seamless; no data was lost but I expected it to be easier than it was.
From the menu bar:
From the device:
I was looking for a Windows Explorer extension that would allow me to browse ISO files as if they were simply a folder, similar to how Windows exposes that support for ZIP files. What I found is WAY better than what Windows providers.
I plan to install this utility on all machines in my household. It just makes managing container files so much simpler. Now, even though I’ve been gushing over it, the utility isn’t without its blemishes. There are a few things that could be done to improve it.
