How to Move WordPress Blog to New Domain or Location

For blogger who self-hosts the WordPress blog publishing system on a web hosting server with own registered domain name, sometimes, you may decide to reorganize the blog link URL to make it tidier or to reflect new focus or theme of the blog. If you decide to change the URL or link location of your WordPress blog due to changing of domain name (such as from http://www.old-domain.com/ to http://www.new-domain.com/) or the blog to another directory location (such as from http://www.domain.com/ to http://www.domain.com/blog/), there are some steps that should be done to ensure the proper migration and no breaking links.

The tricky part when moving WordPress blog to another location is that WordPress is using absolute path in URL link instead of relative path in URL link location when stores some parameters in database. Within blog posts’ contents itself, users may also use the old URLs when creating reference backlinks. All these values in the database will need to be changed when WordPress is moved. The following guide will show you which database fields that has references or values related to blog’s URLs that you want to modify. Note that this guide is not about how to move WordPress blog from one server or host to another new hosting service.

Once the blog has been moved (all files copy over in case of moving location or server or new domain name properly propagated across Internet for new domain name), the first thing to change is to tell WordPress the new blog location (wp-config.php should be no changes, and .htaccess file should be also no changes. If for some reason mod_rewrite rules for friendly URLs no longer works, you can always regenerate the .htaccess file via WP Administration’s Update Permalinks page). This value can be changed via WordPress Options page, but if you no longer able to access to old blog URL, you have to modify the value via MySQL database.

Note: The guide uses SQL statements based on MySQL replace() function to modify the database. To run SQL queries, login to MySQL database that houses WordPress tables via phpMyAdmin or login to the DB server and run MySQL client as root.

To update WordPress options with the new blog location, use the following SQL command:

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';

After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guid field. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

If you have linked internally within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages:

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

Browse through WordPress blog to check if everything is okay. You also need to re-login to WP Administration as authentication cookie has now became invalid due to different domain.

About these ads

123 comments

  1. Its not my first time to pay a visit this website, i am browsing this web
    site dailly and take good information from here all the time.

  2. Paragraph writing is also a fun, if you be acquainted with after that you can write otherwise it is complicated to write.

  3. Hey there, I think your site might be having browser compatibility issues.
    When I look at your website in Chrome, it looks fine but
    when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that, very good
    blog!

  4. Chris Crocker became famous because he was the only person in
    America (possibly in the world. If you like to know some fashion information about the famous brand Tiffany and learn some tips on how
    to dress up and keep your jewelry, this is a good opportunity.
    Anthony Harris is a Platinum Ezine Writer And One Of The Top Internet Marketer Who Has Now Founded The RECIPE.

  5. Thanks designed for sharing such a nice idea,
    piece of writing is pleasant, thats why i have read
    it fully

  6. May I simply just say what a comfort to find someone who actually knows what they
    are discussing online. You actually understand how to bring an issue to light and make it important.
    More and more people must look at this and understand this side
    of your story. I can’t believe you aren’t more popular given that you definitely have the gift.

  7. Hello there! This article couldn’t be written much better!

    Reading through this article reminds me of my previous roommate!

    He always kept preaching about this. I most certainly will forward this post to him.
    Pretty sure he will have a good read. I appreciate you for sharing!

  8. Hi there, yup this piece of writing is in fact pleasant and
    I have learned lot of things from it regarding blogging.
    thanks.

  9. Hello i am kavin, its my first occasion to commenting anywhere, when i read
    this piece of writing i thought i could also create comment due to this brilliant post.

  10. Hi there, the whole thing is going fine here and ofcourse every one
    is sharing facts, that’s in fact fine, keep up writing.

  11. certainly like your website but you have to take a look at the spelling
    on several of your posts. A number of them are rife with spelling issues and I find it
    very troublesome to tell the reality on the other hand I
    will surely come back again.

  12. Hello to all, how is all, I think every one is getting more from
    this website, and your views are good in support of new people.

  13. You actually make it seem so easy together with your presentation however I in finding this topic to be really something which I feel I might
    by no means understand. It kind of feels too complicated and extremely large for me.

    I’m taking a look ahead in your next submit, I’ll attempt to get the hold of it!

  14. Do you mind if I quote a few of your posts as long
    as I provide credit and sources back to your site?
    My blog site is in the exact same area of interest as yours and my
    visitors would truly benefit from some of the information you provide here.
    Please let me know if this alright with you. Appreciate it!

  15. Hey I know this is off topic but I was wondering if you knew of any widgets I could
    add to my blog that automatically tweet my newest twitter updates.

    I’ve been looking for a plug-in like this for quite some time and was hoping maybe you
    would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

  16. I know this web page gives quality based articles or
    reviews and other material, is there any other web site which provides these kinds of stuff in quality?

  17. Great article. I will be experiencing many of these issues as well..

  18. Excellent way of describing, and nice paragraph to obtain facts
    regarding my presentation subject, which i am going to
    convey in institution of higher education.

  19. Awesome! Its truly amazing article, I have got much
    clear idea concerning from this paragraph.

  20. Asking questions are actually nice thing if you are not understanding anything entirely, but
    this post provides nice understanding yet.

  21. If you desire to grow your knowledge only keep visiting this web page and be
    updated with the most up-to-date news posted here.

  22. Hey There. I found your blog using msn. This is a really well written article.
    I will be sure to bookmark it and come back to read more of your useful info.

    Thanks for the post. I will definitely return.

  23. Wow, what a top quality it truly is! Since mainly YouTube video clips have no fastidious feature, nevertheless this is really a superb top quality video.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: