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.


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

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

  1. The Forgettful Website Developer » Blog Archive » Moving a WordPress website to a new host
    September 17th, 2008 05:01
    50

    [...] moving wordpress site [...]

  2. Mudanza del blog | Thuer.com.ar
    September 17th, 2008 00:37
    49

    [...] Mover un blog en Wordpress a otro dominio: “How to Move WordPress Blog to New Domain or Location“ [...]

  3. mirosol
    September 16th, 2008 21:24
    48

    Just used your tutorial and it worked great! Thank you very much!

  4. How to move wordpress blog to new domain or location - Drosophila Genetics and Epigenetics
    September 12th, 2008 04:34
    47

    [...] case of need, THIS can really helps ! This entry was written by Christophe, posted on September 11, 2008 at 10:34 [...]

  5. WordPressのURL移転時の内部リンク書き換え方法覚書 - SharpLab.
    September 10th, 2008 13:48
    46

    [...] バイトで必要になったので調べた。How to Move WordPress Blog to New Domain or Location » My Digital Lifeというエントリが参考になる。 [...]

  6. cathy lopez
    September 9th, 2008 00:23
    45

    You just save my life! lol!
    Thanks for your article.
    It worked great! No fuzz!

  7. Welcome to c64glen.com at C64GLeN - The blog of Glen McNamee
    August 24th, 2008 07:39
    44

    [...] database across, and after a few little changes here and there (wordpress plugins and a few little database changes) all was [...]

  8. Smuggle Me » Export One Wordpress Blog Category to Create a New Blog
    August 17th, 2008 10:38
    43

    [...] Once you have uploaded the posts to the new blog, you’ll also want to consider running the following 2 queries as suggested here: [...]

  9. Piotr
    August 10th, 2008 05:26
    42

    great info :)

  10. How to move WordPress blog from old domain to new domain with 301 permanent redirection - SEO / SEM blog
    August 6th, 2008 18:00
    41

    [...] SQL codes from mydigitallife.info SHARETHIS.addEntry({ title: “How to move WordPress blog from old domain to new domain with 301 [...]

  11. Ken Hung
    August 3rd, 2008 21:45
    40

    YOU TOTALLY SAVE MY LIFE!!!!!!!! THANK YOU SO SO SO VERY MUCH! Yea!

  12. NAthanT
    July 30th, 2008 15:56
    39

    Gold information.

    You saved me hours.

    Cheers

  13. We’ve Moved… Everything Must Go! : Foo Kabloo!
    July 22nd, 2008 11:08
    38

    [...] http://www.mydigitallife.info/2007/10/01/how-to-move-wordpress-blog-to-new-domain-or-location/ [...]

  14. Designer-WG » Blog Archive »
    July 14th, 2008 20:18
    37

    [...] I’ve posted this comment to the mydigitallife.info [...]

  15. Simon
    July 14th, 2008 20:04
    36

    Hi folks,

    I had the same probs, butt I never knew on what it depend’s.

    I changed the sites Url in the admin area of my Wordpress-blog, but that was an fault.
    So nothing would be shown on the right place.
    Therefor I needed to change it back, but there is no way to get in the admin area again logically, after I’ve changed the root Url.

    So I opened my mind to get a solution. And just in this Moment it comes over me:

    …only go on your hosting surface and start PHPmyADMIN and find the following database entry:

    “Your WP-Blog database”–>wp_options–>make this database Entry editable–>now find the row “site_url”–>and change in the “options_value”column the root of your blog–>safe it and it’s done!

    greetings, Simon

  16. rebel
    July 9th, 2008 13:38
    35

    yes there are open
    http://www.demonoid.com/

  17. Nikhil George
    July 1st, 2008 14:18
    34

    Thanks for that. When I googled for this topic another blog said , to this you have to backup the entire database, create new db and upload again. I was really tensed, but this was actually completed in seconds…..:)

  18. ——Sahil Seth dot com—— » Back again…
    June 26th, 2008 22:20
    33

    [...] the first thing to be done was to get hold of all the old posts (though very less in number). Here google served as a saviour and I got hold of a plugin called ‘wp-migrate‘, which let me export all the posts along [...]

  19. Phil
    June 19th, 2008 03:48
    32

    Thanks a lot for this tutorial! I’ve been wanting to do this for months but never dared because I was afraid of losing all my hard work. You really saved my day.

  20. Rhett Soveran
    June 16th, 2008 08:30
    31

    Thanks so much for this post. It was tremendous help. That was so easy to follow and worked perfect.

  21. scriptygoddess » Blog Archive » Moving a Wordpress Install
    June 15th, 2008 05:29
    30

    [...] all their sites to the new site. Some of these sites were wordpress powered. Thankfully, I found this article that made the move a [...]

  22. Worcester NO2ID
    June 14th, 2008 02:09
    29

    Thanks for this!

    Everything working. Thanks for providing this valuable resource. Was invaluable for helping move our prototype Wordpress installation from my home server to full on hosting!

  23. Stuart
    June 10th, 2008 00:26
    28

    I had no problem running the first query – the site found the home page instead of displaying a 404 error.
    But whilst the second query executes (I am told 2 rows are affected) and when I click a link in the new domain site the correct url is shown in the address bar, all I get is a 404 Not found message saying the requested URL is not on the server – what does this suggest, have I lost some files?

  24. Chad McCanna
    June 9th, 2008 03:03
    27

    I just executed this command through PHPMyAdmin after dealing with 2 days of phantom redirects… turns out all that was wrong is I forgot to change the URL. This solved ALL my problems. You have no idea what a godsend this blog was to me. THANK YOU!

  25. radyo dinle
    June 2nd, 2008 15:34
    26

    hi @ all i need plug in for hosting for wp who can help me

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

moving wordpress - move wordpress blog to new domain - wordpress change domain - move wordpress - migrate wordpress - wordpress move domain - moving a wordpress blog - how to move a wordpress blog - moving wordpress to a new server - migrating wordpress - move wordpress to new host - move wordpress blog - moving wordpress to a new domain - moving wordpress blog - wordpress domain - move wordpress installation - move wordpress to new domain - how to move wordpress - how to move a wordpress blog to a new host - moving wordpress to new domain - how to move wordpress blog - moving wordpress to new host - wordpress domain change - how to move wordpress blog to another domain - how to migrate wordpress - move wordpress new domain - how to move wordpress blog to new host - move wordpress to another domain - how to migrate wordpress blog - moving a wordpress site - migrating wordpress to new domain - change wordpress domain - move wordpress domain - moving a wordpress blog to a new host - Moving wordpress database - moving wordpress to another domain - move wordpress blog to new host - wordpress migrate - moving wordpress site - link wordpress to domain - how to move wordpress to new domain - migrate wordpress blog - move wordpress - wordpress domain name - wordpress move blog - move wordpress different domain - wordpress new domain - move wordpress to different domain - migrate wp to another domain - wordpress moving domains -