Thursday, June 17, 2010

Move Wordpress to another host

Simple process to get work.

Wordpress application run in another host or another url.

Wordpress will configure all the paths in database only, ex: when you upload any image, its absolute path stored in database. And all content will reside in wp-content folder.

New host
1. First install new wordpress in new host

Old host
2. Take mysql backup from old site. or goto Tools -> Import in wp-admin.
This should be used later for running old application

Old host
Login admin panel of old site, Goto settings -> General
change WordPress address (URL) and Blog address (URL) against new host and click "Save Changes"
Now the database will updated with new host urls.

4. Old host
Goto phpmyadmin and export the database or goto Tools -> Export in wp-admin.

5. Old host
Revert back the database with old one, i.e we took backup on step-2.

New host
6. Import the old application's database which we get from step 4.

New host
7. Copy the wp-content folder from old host and pasted it into new host.

Now, upon completion of these steps we can sucessfully run the same application in both the hosts.

( OR )

You can copy all the files from old server and pasted it in new server and follow below process.

wp-config.php is the main configuration file for database connections and others.

Edit wp-config.php file to suit with your database
//DB_USER etc.,

Open database goto wp_options table and change the below two rows

option_value='your-new-url' where option_name='site url' and
option_value='your-new-url' where option_name='home'.

If you didn't change this siteurl value in this table your site will connect to old site when you try to access admin panel.

After done, goto /wp-admin section through browser and enter admin details.
Then goto Settings -> General -> change urls.
Now site configured and worked properly in new server or localhost.

In database replace every occurance of http://oldserver/wp-content links with http://newserver/wp-content. So that image links are worked currectly.

Some settings are fixed in wp-settings.php file.

Complete Reference

Custom fields in wordpress

Move Wordpress to another host

Bigdump used to import large databases