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.


164 Responses to “How to Move WordPress Blog to New Domain or Location”

Pages: « 7 6 5 4 [3] 2 1 » Show All

  1. Piplos’ blog » Spostare WordPress su un altro dominio
    January 2nd, 2009 23:15
    75

    [...] [via MyDigitalLife] [...]

  2. Flip
    January 1st, 2009 02:45
    74

    Thank you very much!

  3. Help
    December 7th, 2008 11:22
    73

    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.

  4. Wouter Volkeri
    December 5th, 2008 18:54
    72

    Thanks man. Everything is working again! :-)

  5. Lyna
    December 5th, 2008 14:29
    71

    It’s perfectly working!

    Thanks a lot!

  6. De VinnieBlog site is verhuist !!! |
    November 22nd, 2008 00:51
    70

    [...] How to Move WordPress Blog to New Domain or Location [...]

  7. TauAs
    November 21st, 2008 02:45
    69

    Thank you very much! everything works perfectly.

  8. Ovidiu
    November 15th, 2008 16:09
    68

    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 :-(

  9. ovidiu
    November 15th, 2008 00:32
    67

    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/

  10. ovidiu
    November 15th, 2008 00:15
    66

    just moved my blog and this page saved my life.
    have to point out though, that I was not using the default table prefix :-) but that was easy to figure out.

  11. John
    November 9th, 2008 12:12
    65

    You’re a rock star! Worked like a charm. Thanks a ton!

  12. Serggg
    November 7th, 2008 21:37
    64

    I follow him to serve my turn upon him:we cannot all be masters, nor all masters.Cannot be truly follow’d.

  13. Webspace of Eric Brodeur » Moving a WordPress blog to another folder
    October 26th, 2008 02:23
    63

    [...] 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 [...]

  14. how to move a local wordpress to live blog? | Blog Design Studio
    October 20th, 2008 15:37
    62

    [...] 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 [...]

  15. malcolmm
    October 13th, 2008 02:51
    61

    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.

  16. Andrew Wii
    October 10th, 2008 19:26
    60

    Great effort of providing latest Word Press information.

  17. Jagtesh Chadha
    October 10th, 2008 12:22
    59

    Thank you! You’re a life saver!

  18. Random writings » 转移WordPress到另一个URL
    October 6th, 2008 13:19
    58

    [...] 想读更详细的解释,请阅读How to Move WordPress Blog to New Domain or Location Written by admin in: Web Development | [...]

  19. Velvet Blues
    October 5th, 2008 01:53
    57

    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.

  20. lifeiseasy
    October 2nd, 2008 03:12
    56

    wow, thanks for the information..:)

  21. turnkey websites
    September 30th, 2008 05:29
    55

    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.

  22. alex robinson » Blog Archive » Migrating mom’s wordpress
    September 28th, 2008 20:54
    54

    [...] …as per the instructions of this guy. [...]

  23. 7ota
    September 21st, 2008 14:59
    53

    Thanx for that , its help me soooo much

  24. Joomla CMS
    September 20th, 2008 07:39
    52

    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 :-)

  25. Autoversicherung
    September 20th, 2008 06:10
    51

    My Favorit Blog. Very thanks and best regards from Germany. Thanks

Pages: « 7 6 5 4 [3] 2 1 » Show All

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. To receive notification of latest comments posted, subscribe to My Digital Life Comments RSS feed or register to receive new comments in daily email digest.
Custom Search

New Articles

Incoming Search Terms for the Article

move wordpress blog to new domain - how to move wordpress - migrating wordpress - migrate wordpress to new domain - moving wordpress - wordpress new domain - how to move wordpress blog to another domain - move wordpress - moving wordpress blog to new domain - move wordpress to new domain - wordpress move blog - Moving WordPress to a New Server - change blog domain - how to move wordpress blog to new host - how to move wordpress to new domain - how to change domain wordpress - linking wordpress to domain - moving wordpress site to new host - moving wordpress change domain - wordpress blog title sql - migrate wordpress to new server - move wordpress to another domain - wordpress sql to move to another url - wordpress domain - wordpress migrate - change domain wordpress - how to move wordpress to a new domain - migrate wordpress - migrate wordpress domain - moved wordpress can't login - wordpress change domain mysql - easy way to move wordpress from a server to another server - How to transfer a wordpress site to another url - moving wordpress to a new domain - move wordpress to new host - wordpress moving site - change wordpress to different domain - hosting wordpress sql database on different server - how do i host my wordpress blog on another domain - how to migrate wordpress - How to Host Wordpress Blog in A Domain? - how to move a wordpress installation - howto wordpress domain - how do i transfer my wordpress blog from one domain to another - migrating wordpress - migrate wordpress server - migrating servers wordpress - move wordpress to new server - move wordpress blog - move wordpress blog to server -