I recently moved this blog from a server at MIT to one at a private hosting company. I looked online for ways to do this, and the official instructions from the WordPress people were convoluted and laborious, especially if you want to keep your old site running after the new one is established. They also required you to break your old site for a short period of time. Given that keeping your old site up makes sense in order to make a graceful transition and let search engines have a chance to catch up, I wanted to find a way to make the move in a less painful way. Fortunately, there is a very easy way to do so if you have access to either the “mysql” command on a UNIX-based hosting server, or myphpadmin through the web. The vast majority of people should have access to one or the other. Here is what I did:
- Create a tarball of your WordPress installation on the old server.
- Copy over the tarball to the new server, and extract into the directory of your new site.
- Change wp-config.php on the new server to match your new SQL server settings. This is only a few lines that need to be changed.
- On your old server create a .sql script file using either mysqldump or myphpadmin. There are plenty of places on the net which will tell you how to do this. Check the documentation on your host for specific help.
- Now, here’s the trick that makes this a whole hell of a lot easier than other instructions out there: use a text editor or script to automatically find and replace every instance of your old URL in the .sql file with the new URL of your blog. Microsoft Word can do this, for example, but if you’re a real geek, you’ll use something like sed or perl. (For something like this, sed is more than enough.) The reason this needs to be done is that not only is your site referenced in the WordPress configuration, but it’s also probably unfortunately hardwired a lot of places in your posts in links to media. This way, you’ll move over not only your database, but also all the media and references to them.
- Load the modified database into your new SQL server using, again, either mysql command line tools or myphpadmin.
It actually took me longer to type this than to actually do it, so don’t be put off by the length of these instructions. While they aren’t as complete or hand-holdy as the ones you’ll find elsewhere, if they work they should be MUCH less effort, and give you a new location for your blog with everything moved over correctly. More importantly, it’s actually SAFER the way I suggest above, because unlike the official “codex” way of doing it, you never do any writes to your old blog’s files or database. Nonetheless, as always back up everything before trying this, and I disclaim all responsibility for anything that happens to you as a result of following these instructions. In fact, while I’m at it, let me just disclaim all responsibility for anything, in general.
I hope this helps (the instructions, not the disclaimer). Before I leave you to it, a few troubleshooting tips:
- Make sure your permission are correct. The old server may have a different setup than your new one. In particular, you may need to enable group read and write permissions.
- If things don’t work right away, it may be neccesary to play with the “permalink” settings on the new site so as to write a new .htaccess file.
- If you use a regexp-based script to do the URL find and replace, make sure you correctly escape the “dots” in the URL, and the forward slashes.
One Response to How to (easily) move a WordPress blog to a new site
Leave a Reply Cancel reply
Tags
757 amp apple automatic updates baby bad touch best beware Boston Clinton Clinton cockpit delegates Democrats f-sharp flightdeck google Harmon Kardon healthcare humor interesting interference investing iphone libertarians linux marketing math Microsoft MIT not funny Obama oil Photography programming race rant receiver RF Stata statistics superdelegates Vista weird Windows








haha,
well looks like i’ve found the birge that was competing with me for all the birge.something domains. I noticed you grabbed .us just before i went for it and then stumbled over here for my uncle but you got here first
.
Currently the proud owner of .me!! Looks like .com has been squatted by a domain name dealership. Commercial squatting a**holes – ICANN will sort it out eventually. Value of our virtual real estate is really becoming a serious thing. Fortunately the birge name seems to be relatively rare (apparently only three registered to vote in the UK, where we are).
Nice blog…