Saturday, May 1, 2010

Migrate wordpress site and database to different servers

The following steps will help you to migrate the current wordpress site to different server (domain). I am assuming that you want to migrate the database also from the
old database server to a new database server
1. make a backup of the current wordpress site in your local directory
2. export the database and save the exported file in your local directory
3. copy the wordpress installer to the new server
4. create a database in the new database server
5. open the wp-config file of the new wordpress installer and provide the correct database information
6. Now install the wordpress by going to the wp-admin/install

This will install a fresh copy of  wordpress and database
7. Now go to the database and delete all the tables that have been created
8. Import the old database file (created in step2).
9. go to the table wp_options and change the entry of siteurl and home to your new wordpress server (from htttp://oldwordpressserver/ to htttp://newwordpressserver)
this step is done so that when you migrate the old wordpress to the new server the links start pointing to the new wordpress server
10. Now you need to copy the old wordpress files that you had saved in step 1 to the new wordpress server. Just replace all the files with the new ones
11. If you now open the home page of the wordpress site from the new server you should see the old content. In case the links are broken or the pages are not opening then you
should open the admin page http://newserver/wp-admin and click edit on any post. click on the changepermalinks. select the default option and save. This will reset all the links for
the pages according to the newserver. You can later change the permalinks again to some other option.

Following the above steps should help in migrating the site.
Note: you can directly copy the old wordpress files and old database without installing a fresh copy of wordpress. I tried it but was getting some errors. So I would suggest follow the above steps.