Moving Your WordPress Blog to a New Domain
Recently I’ve had the task of moving a WordPress blog from one domain name to another. Moving WordPress to a new domain isn’t called for very often but there maybe times when you need to and want to keep all your old content.
I haven’t seen a lot written about how to do this but it is not difficult so here is a brief tutorial about how I have done it.
This isn’t destructive to your old blog so it can happily sit where it is until you decide what to do with it. I have assumed you already know how to set up a MySQL database, and know how to use phpMyAdmin. If you don’t now would be a good time to learn.
- The first task is to take a backup of your existing WordPress database. To do this simply use the backup plugin that comes with WordPress. The core database tables are backed up by default but be sure to check any other tables that may have been created by plugins that you will also need. Just download the database to a convenient location on your computer.
- The second step is to download all the WordPress files and anything else you want from your old domain by FTP to a convenient location on your computer. Make sure that you maintain the directory structure as we will use the files for the new site.
- Now we can begin to set up the new blog by creating a new database making a note of the database name, user name, password and host.
- Next open up the WordPress config.php file from the files you downloaded from the old blog and change the old database setting to the new ones and save the changes.
- Now upload all the files including the edited config.php to your new webspace by FTP.
- While the file are uploading we can take a look at the database files we downloaded earlier. First unzip the database and open it up in a text editor. Now we need to replace every instance of your old blog URL with your new blog URL so for example search for http://oldblog.com/ and replace with http://newblog.com/. Most text editors have a feature that will do this automatically for you and there may be hundreds of instances in the database so I wouldn’t advise trying to change them one at a time. Once you have done this save the changes.
- Hopefully by now all the files have uploaded. Open up your phpMyAdmin and navigate to your new blogs database from the dropdown list on the left and then choose Import from the tabs at the top. Browse for the file you just edited and select it and click Open and then hit Go in phpMyAdmin.
- Now you wait for phpMyAdmin to do its thing.
Assuming everything went right you blog should now be set up and working and all your old content will be in place. If it hasn’t worked you may want to double check that you edited the config.php with the correct details and that you entered the correct URL in the database file.
If you are using Windows I would suggest that you don’t use Notepad that comes with Windows. There are plenty of free text editors that are far superior. One open source example is Notepad++.
This entry was posted on Saturday, November 25th, 2006 at 1:19 pm and is filed under WordPress. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.
April 18th, 2007 at 5:37 pm
[...] daunting experience which is why I’d suggest you read this excellent article at Webgazette - Moving Your WordPress Blog to a New Domain. It does exactly what it says on the tin and is dead easy to [...]