How To Move WordPress Site And Change The Domain

Just moved a WordPress site from one host to another, site domain also changed.

Reference article from WP Docs: http://codex.wordpress.org/Moving_WordPress

What I’ve successfully done:

Step 1

Download the whole site files and put into new host directory.
Export the database, create a new database in new host and import all the data.

Step 2

Open wp_config.php
setting database info: db_user, db_password, db_host, db_name ( if anything is changed )

Step 3

You can skip step 3 if you will do the step 4.

Go to the new database
Open wp_option table, find ‘siteurl’ and ‘home’, change the old url to new one ( note: ‘http://’ must be included in the url )

Step 4

Replace database table old url ( Only perform a search and replace on the wp_posts table. )

using this tools, recommended by WP docs: http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
very easy to use. copy the php file into root directory and run it.

Step 5

The site should be working now.

But when click any page, I got a 404 error then. Can’t find index.php. Permanlink is not working. It all works fine if I change the permalinks to their default setting (Wp-Admin> Settings> Permalinks).

That’s because of .htaccess file. Comment all the old rewrite rules and change the permalinks setting again, should be alright!

That’s all. Hope this will be helpful to everyone.

Leave a Reply