• Home
  • Archives
Subscribe: Posts | Comments | E-mail
  • Tech CornerNews and tips on latest gadgets.
  • Web Analytics / MarketingTips on SEO, Google Analytics, WebTrends
  • Web DevelopmentHTML, CSS, JavaScript, Ajax, jQuery, PHP, Flash.

Dr. Div

Posted on July 1, 2009 - by Dr. Div

How to Move Your WordPress Website to Another Domain or Go Live From Your Localhost

Web Development

wp_domainmove

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:

  1. On your old website, go to your database management application (generally mySQL or phpMyAdmin).
  2. 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.
  3. 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.)
  4. 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:

  1. Copy your entire wordpress folder, say “blog”,  into the new website’s root directory.
    (i.e. www.oldsite.com/blog  —->  www.newsite.com/blog)
  2. 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.
  3. 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

2 Comments



  1. Visit My Website

    July 6, 2009

    Permalink

    Flash said:

    Nice!



  2. Visit My Website

    July 13, 2009

    Permalink

    Luke said:

    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.



Leave a Comment

All Symptoms Welcome

  1. Name (required)

    Mail (required)

    Website

    Message

  • Worth-a-watch Ads

  • RSS Latest Gadget News by Engadget

    • Best Buy to slash prices for old Xbox 360 special edition bundles tomorrow?
    • Hacker intercepts phone calls with homebuilt $1,500 IMSI catcher, claims GSM is beyond repair
    • Switched On: The Galaxy S paradox
    • Dell Studio XPS 9100 arrives with six cores, little fanfare
    • Engadget Podcast 207 - 07.31.2010
  • Tag Cloud

    • Adobe Amazon Android apple App Store AT&T BlackBerry Bluetooth Chrome Engadget Facebook Gadgets Gaming Google Hardware Hewlett-Packard Home Theater HTC Intel iPad iPhone Kindle latest gadgets LG Mac Microsoft Mobile Motorola Nexus One Nokia Online Other PC Samsung Software Sony Sprint Steve Jobs T-Mobile Twitter Verizon wifi Windows 7 Windows Mobile YouTube
© 2009 Dr. Div - Website Prognosis & Therapy