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.
Related Articles
- Using PHP-MySQL Persistent Connections to Run WordPress Blog
- Replace Google Blog Search with Technorati for Incoming Links in Dashboard of WordPress
- WLWManifest Disabler Plugin to Remove XLM Link in WordPress Blog Header
- AdSense and Display Banner Ads Rotation in WordPress Blog or Websites
- How to List and Show WordPress Posts That Comments and Pings Off (Not Allow)
- Moderate WordPress Blog Comments Via Moderator with Desktop Client
- How to Rename or Move Oracle Tablespace Datafile to Another Location
- Google Domain Names Registration and Search for Free Apps for Your Domain
- Integrate and Display Google AdSense for Search and Co-Op Custom Search Engine Results in WordPress Blog Page Template
- How to Delete Existing WordPress Post Revisions Stored/Saved










































October 6th, 2009 04:18
[...] need to edit, these articles will steer you to the right place: Moving WordPress WordPress Codex How to Move WordPress Blog to New Domain or Location My Digital Life To REALLY automate this you could write an install script that copied and expanded the files, [...]
October 1st, 2009 11:35
I followed the above steps for moving to a new location in my server and also a new domain name. While everything works fine I am not able to login to wp admin. It takes the user p/w but gives me HTTP 403 error in internet explorer. Please help.
September 19th, 2009 18:18
Thanks for making this tutorial, now my problem is solved. Thanks.
September 17th, 2009 19:13
thancks
this post very very helped me !
Good Time
September 14th, 2009 01:07
For me a much easier way to do it is:
1. Do a database dump with the mysqldump command.
2. Replace all occurrences of http://oldsite to http://newsite
3. Restore the database with the modified dump
September 13th, 2009 15:52
Just wanted to say, thank you – this post was a big help.
September 10th, 2009 06:30
Why don’t you just change the domain in the options just before your ready to move. That’s how I did it and it worked great.
September 5th, 2009 20:03
Great information for sure, but I confess it seems too much work for my purposes. I think I will keep the domain I have. Thanks.
August 27th, 2009 15:59
thx a lot. It seems a lot easier than I thought. Implementing this on my blog was quicker than writing my post above.
August 12th, 2009 13:02
[...] you’ve followed the standard operating procedure for moving the blog, and all database entries are updated to the new path (I did this part manually, but the linked procedure seems OK), the most likely [...]
August 9th, 2009 22:24
Thanks for the essay.
Can I put this essay to my general content site?
Thank you so much again.
August 5th, 2009 08:45
Thanks for the info – don’t forget to post about the Australian domain name industry – it’s really starting to take off… Thanks again
August 4th, 2009 23:32
man, you rock. This just saved me an hour of head-banging. worked like a charm the first time.
thanks!
July 31st, 2009 17:19
[...] How to Move WordPress Blog to New Domain or Location [...]
July 27th, 2009 18:17
Great Post, saved me ages, many thanks!
July 16th, 2009 11:33
[...] made the migration using this fantastic post on how to move a Wordpress blog to a new domain. So, update your RSS feeds and I’ll see you over there. Category: Uncategorized [...]
July 16th, 2009 01:43
[...] how do i change the domian of my blog , just bought a new.. How to Move WordPress Blog to New Domain or Location My Digital Life [...]
July 15th, 2009 03:08
[...] v angličtině viz My digital life. [...]
July 14th, 2009 17:42
lifesaver! thanks for this, have been scratching my head for a week or so trying to solve it on my own.. thanks
July 14th, 2009 15:36
[...] enkele parameters in je database (nieuwe url). Hier een overzichtje met de te nemen [...]
July 13th, 2009 12:53
I just imported 175 posts from a Blogspot fiction blog into a new Wordpress blog that a friend is offering to host for free! Problem is, I was using a custom book-inspired layout that showed one post at a time, with a series of menus linking the various posts together. Now all those menu links still point to the old posts at Blogger.com. Would the above technique convert those links quickly once the WP blog is hosted? Cause right now I’m resorting to cutting and pasting…
July 12th, 2009 06:45
[...] Reference: How to Move WordPress Blog to New Domain or Location [...]
July 11th, 2009 04:33
Thanks for the info, great guide for moving a WP site – I send people to this page all the time when they ask me how to do it.
July 9th, 2009 21:21
thankyou for the nice and helpful information.
July 8th, 2009 16:02
I was really confused why things were pointing back to the old domain. This guide made it really easy for me.
Thank you so much!