Question Asked: How Do I Move My WordPress Blog To A New Domain?

Comment On This »

Mar 16th, 2009

I get this question a lot, in my day to day life, and see it on message boards all the time.  Though it’s super easy to do, for those that know how, it may be complicated for those that don’t.  

I’ll outline all the steps you need to take, in order, and you’ll be moving blogs before you know it.

  1. Purchase your new domain name, and set it up with your host.
  2. Download all your files from your old domain name.
  3. Upload those files to your new domain name.   (We’re going to assume you’re using the same web host, and same MySQL database.)
  4. That’s it, as far as moving files.  Now, there’s just a few changes you need to make to your database.  You’ll need to login to phpMyAdmin to do these next few steps.  If you don’t know how to do this, consult your web host.
  5. Once in phpMyAdmin, navigate to the database for your WordPress blog, and click the “SQL” tab across the top of the right frame.
  6. The first query you want to run, is this: UPDATE wp_options SET option_value = replace(option_value,
    'http://www.old-domain.com', 'http://www.new-domain.com') WHERE
    option_name = 'home' OR option_name = 'siteurl';  
    (This simply updates the two variables in your blog’s database, to tell your database what your blog’s URL is.)
  7. The second query you want to run is this:  UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com'); (This simply updates your post’s individual URLs from your old domain, to your new domain.)
  8. The last query you need to run is this: UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com'); (This query updates all your posts that have links to your old domain in them, to the new domain.)

A few things you should note about these queries:

  • Ensure you replace www.old-domain.com and www.new-domain.com with your old and new domain names.
  • These queries assume that you haven’t changed the default table prefix from wp_ to anything else.  If your WordPress tables are prefixed with something else, be sure to change it in your queries.

That’s all you need to do.  If you encounter any errors, post a comment below, and I’ll do my best to help you.

Other answers you may find useful:


Previous Post

Next Post

« »


Comment On This Post

 

 

Ask MJ Your Question

Submit your question to Ask MJ and MJ will answer your question on the site, and email you to let you know it has been answered.