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










































January 2nd, 2009 23:15
[...] [via MyDigitalLife] [...]
January 1st, 2009 02:45
Thank you very much!
December 7th, 2008 11:22
Could someone possibly interpert this info and lay it out a little more basic. The writer is on track but not very helpful on the step by step aspect for us more basic users. I know this is what I need to do but cant tell where to do some parts in the host or in wordpress.
December 5th, 2008 18:54
Thanks man. Everything is working again!
December 5th, 2008 14:29
It’s perfectly working!
Thanks a lot!
November 22nd, 2008 00:51
[...] How to Move WordPress Blog to New Domain or Location [...]
November 21st, 2008 02:45
Thank you very much! everything works perfectly.
November 15th, 2008 16:09
need some urgent help guys. my move from subfodler to root wen smoth, excet that now, evry page is extemely slow, even if I only browse through the backend
Ieven put the site in maintenance mod and deactivated all plugins and still as soon sI hit any page o this blog, cpu load goes to 80% nd the page comes down to a crawl. l other sites n thesame server are still actin normal.
ts leads me to th assumption that there are ome rdirects somewhere which are slowing it down. any hints what to check?
Except from the slowliness all is workin
November 15th, 2008 00:32
also one might have other places that mention the old url, so this plugin could also help: http://wordpress.org/extend/plugins/search-and-replace/faq/
November 15th, 2008 00:15
just moved my blog and this page saved my life.
but that was easy to figure out.
have to point out though, that I was not using the default table prefix
November 9th, 2008 12:12
You’re a rock star! Worked like a charm. Thanks a ton!
November 7th, 2008 21:37
I follow him to serve my turn upon him:we cannot all be masters, nor all masters.Cannot be truly follow’d.
October 26th, 2008 02:23
[...] your blog posts contain images or links using the old folder they must be changed. There is a simple SQL command which performs a search and replace. I suggest using phpMyAdmin instead of MySQL’s command [...]
October 20th, 2008 15:37
[...] of moving things as well. MyDigitalLife has written this excellent article, which tells you that how can you move WordPress blog to a new domain name. You just have to use this way [in this case the old domain will be http://localhost/ (in most of [...]
October 13th, 2008 02:51
very useful post – thanks. I saw mention of the plugin, but I prefer to do it this way, so that I can see what I am doing to the database.
October 10th, 2008 19:26
Great effort of providing latest Word Press information.
October 10th, 2008 12:22
Thank you! You’re a life saver!
October 6th, 2008 13:19
[...] 想读更详细的解释,请阅读How to Move WordPress Blog to New Domain or Location Written by admin in: Web Development | [...]
October 5th, 2008 01:53
Great post. We just released a plugin which simplifies this process for people who don’t want to, or don’t know how to, use phpMyAdmin.
All users need to do is upload the plugin and enter their old and new urls. Then presto, All links are updated!!!
Check out the Update URLs plugin here.
October 2nd, 2008 03:12
wow, thanks for the information..:)
September 30th, 2008 05:29
thanks for the great info i was having a blog of jokes
http://www.top-jokes.info where it was difficult to load and after making the changes you have listed above its been very easy for me to use the old website da\ta on my new domains.
thanks again.
September 28th, 2008 20:54
[...] …as per the instructions of this guy. [...]
September 21st, 2008 14:59
Thanx for that , its help me soooo much
September 20th, 2008 07:39
I have been using Joomla CMS since it’s beginning and really love it.
At the moment I am considering to use Wordpress as my blogging tool, and since this guide illustrates the easiness of the movement process, I am feeling a bit safer to convert
September 20th, 2008 06:10
My Favorit Blog. Very thanks and best regards from Germany. Thanks