Posted on July 1, 2009 - by Dr. Div
How to Move Your WordPress Website to Another Domain or Go Live From Your Localhost

Let’s say that you have a blog on www.oldwebsite.com/blog/ directory and you would like to move it to www.newwebsite.com/blog/. Or, you developed your WordPress website or blog locally and it’s located in http://localhost/blog/. There are two main entities that you need to copy over to the new site: Database and Files.
In a nutshell — here are the steps:
(I’ll be using www.oldwebsite.com/blog in the following examples.)
DATABASE:
- On your old website, go to your database management application (generally mySQL or phpMyAdmin).
- Go into the database and export database as a file with sql extension. Do not forget to click into the database first as this will export the tables of the database which is what we want. If you forget to go into the database and do an export, it won’t work when it comes to importing it into another site. Remember, what you are importing are just the tables in a database, not the database itself.
- Create a new database on the new website. If you have a database username/password, you can assign it to the new database. Or, you can create a new user/password—it’s totally upto you. (Keep the database name, username, and password handy, as you’ll need them later.)
- Now the same way, click into the new database on the new site’s database management application and import the file that you acquired on step 2. (You will be importing the tables in the newly created database.)
FILES:
- Copy your entire wordpress folder, say “blog”, into the new website’s root directory.
(i.e. www.oldsite.com/blog —-> www.newsite.com/blog) - Open up the wp-configsample.php file (www.newsite.com/blog/wp-config-sample.php) and add the database name, username, and password which you acquired on step 3 above. Then, save this file as wp-config.php into the root (www.newsite.com/blog/wp-config.php). It will ask to overwrite. Click ‘Yes’ as you will not be needing your old database configuration anymore.
- Check Point – Load up your new site’s home page and see if everything displays properly on the home page. If not, please go back and see what must have gone wrong. There is still one more fix to do. See below:
Fixing the Absolute Links in the Database:
As WordPress database uses absolute links in the posts and options table, these tables have to be updated via three SQL commands on your database management application as below: (Just paste them in one-at-a-time into the SQL field and click “Run” or “Execute”).
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldwebsite.com/blog', 'http://www.newwebsite.com/blog') WHERE option_name = 'home' OR option_name = 'siteurl';UPDATE wp_posts SET guid = replace(guid, 'http://www.oldwebsite.com/blog','http://www.newwebsite.com/blog');UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldwebsite.com/blog', 'http://www.newwebsite.com/blog');
That’s all folks. Write a comment below if you have any questions or need any help.
DrDiv

Visit My Website
July 6, 2009
Permalink
Nice!
Visit My Website
July 13, 2009
Permalink
I had to do a bunch of research on this a couple months ago for a client. I ended up just exporting the posts and pages from the existing WP install and then importing into a brand new WP install on the new server, instead of actually dealing directly with the DB.