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.


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

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

  1. Wordpressthemegenerator
    July 3rd, 2009 13:37
    123

    worked perfectly – many thanks !

  2. Mike
    July 3rd, 2009 10:37
    122

    Thank you so much for this! I just had to transfer my blog to a new site and this was very concise and helpful.

  3. Mike S
    June 19th, 2009 03:51
    121

    I couldn’t have done it without you!! Worked perfectly and very simple. Thanks.

  4. Free Web Directory
    June 16th, 2009 09:03
    120

    after moved my blog in to new host i can’t login my blog ??

    Why ??

  5. Sajid
    June 4th, 2009 19:39
    119

    Thanks so much for this!

  6. Pakistan
    June 4th, 2009 19:21
    118

    Discover the beauty of pakistan. Learn the culture, heritage, traditions and landmarks of different parts of Pakistan especially sindh, punjab, balochistan and N.W.F.P and far northern areas.

  7. Jez
    June 2nd, 2009 21:32
    117

    Thanks Great Help

  8. Andrew Kolyvas
    May 27th, 2009 18:08
    116

    Just moved my blog to my new domain http://www.incomesinternationl.com.

    Worked perfectly.

    Thanks, I appreciate your work.

    For those that are having trouble, when using phpmyadmin, make sure you click on the SQL tab then copy in the the 3 queries that have been provided here. Make sure you change the vales for the old-domain.com and new-domain.com and that is all that you will need to do.

    Andrew Kolyvas

  9. oyun hileleri
    May 24th, 2009 01:20
    115

    Thank you. This worked perfectly.

  10. StoneTalker
    May 20th, 2009 13:49
    114

    it works perfectly.Thank you for sharing this great information with us.

  11. Phantom Paul
    May 17th, 2009 04:46
    113

    Brilliant – worked perfectly – many thanks !

  12. Daniel2b
    May 14th, 2009 03:25
    112

    You totally saved me I never would have known how to fix it! Thanks so much!

  13. Infopreneur
    May 14th, 2009 01:33
    111

    Awesome info, this saved me some great webmastering time! Thanks!

  14. Ryn Garcia
    May 9th, 2009 08:14
    110

    Thank you. This worked perfectly. =]

    All I did was copy and paste. =]

  15. Dr. Jim Anderson
    May 6th, 2009 10:00
    109

    Great article. I just moved my WordPress 2.7.1 blog from one domain to another (same server, same MySQL database). A couple lessons learned:

    1. It’s REALLY important that you get your quotes ” correct. I cut & pasted the SQL commands and they didn’t work the first time because the single quotes were too fancy – I typed over them and all was good.

    2. The odd thing was that the three SQL commands didn’t change a single thing. I believe that the two plugins had already made all the required domain name changes.

    3. There is a wee bit more editing that you need to do in the MySQL DB – you can do it via phpmyadmin. The tables _users, _usermetadata, and _options all need to be reviewed and all occurrences of your old_domain need to be replaced with your new_domain.

    4. THIS IS THE ONE THAT GOT ME: please be aware that phpmyadmin will only display the first 30 or so columns of data in a given table. The _options table has MANY more columns than 30. If you forget to change ALL of the occurrences of your old_domain, then you may encounter a “You are not authorized to view this page” error when you log into WP after making your changes.

    5. Don’t forget to edit your wp-config.php file in order to change the name of the MySQL database tables being used in the $table_prefix variable.

    Good luck and make a backup of your database BEFORE you start!

    - Dr. Jim Anderson

  16. Moving Your Wordpress Blog To A New Domain Name, The Ins and Outs…
    April 17th, 2009 08:53
    108

    [...] This trick came from an excellent post over at My Digital Life [...]

  17. Installation « How To
    April 14th, 2009 10:40
    107

    [...] mysql commands – Move wp and change “home” and [...]

  18. How to Move a Wordpress Database | Always Get Better
    April 4th, 2009 23:48
    106

    [...] As I said I typically search for this information whenever I need to move Wordpress sites. I find the SQL queries at: http://www.mydigitallife.info/2007/10/01/how-to-move-wordpress-blog-to-new-domain-or-location/ [...]

  19. domain name
    March 31st, 2009 21:08
    105

    Yeah, I had that problem with my domain too. I bought a new domain name and when i was transfering my blog onto the new domain, all messed up and i lost a lots of my data:(
    Anyway i recovered after some time, it was obviously in the beginning. :)

    But i’m sure information you have provided here will be helpful to may others who are looking forward to shift their blog to a new domain name.

  20. March
    March 31st, 2009 20:02
    104

    Hello, i have installed wordpress to domain.org, but i need to have domain.com as main domain (domain.org i wolud lik to be parked) of that installation. If ponit name servers (domain.com) to hosting where is wordpress installed would by blog work??

  21. Media Temple: Moving WordPress and MediaWiki from (gs) to (dv) | indigoprime
    March 23rd, 2009 11:01
    103

    [...] I’ve moved domains, the databases needed some work to fix links. I found an article that was of help, but what you basically do [...]

  22. Alex
    March 20th, 2009 22:48
    102

    works perfectly. thanks!

  23. Hélio Sassen Paz
    March 20th, 2009 04:53
    101

    Hi, folks! ;)

    I’m beginning to transfer the content of a free WP.COM blog to a payed domain and hosting service that supports WP but I still can’t do it. ;(

    How is the procedure when I need to transfer all content posted on a free WORDPRESS.COM to a payed hosting service with my own domain?

    I want to transfer my wordpress.2009-03-19.xml from heliopaz.wordpress.com to heliopaz.com but the wp-admin doesn’t allow me to upload a XML heavier than just 2 MB and my XML has 13.7 MB.

    My host provides a great job but the online chat couldn’t help me and I’m waiting so long for the helpdesk response.

    Any solution? May I have to ask my host (or even pay a few more bucks) to increase the space from 2 MB to 15 MB on my heliopaz.com wp-admin page?

    Or could I use a FTP software to upload my XML file to a specific directory? In this case, where exactly I have to upload this file?

    Thanks a lot!

    Hélio Sassen Paz
    Porto Alegre/RS
    Brazil

Pages: [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 - move wordpress blog - moving wordpress to a new domain - moving wordpress blog - migrating wordpress - move wordpress blog to new domain - wordpress domain - migrate wordpress - how to move a wordpress blog - moving a wordpress site - wordpress change domain - wordpress move domain - how to move wordpress blog - moving wordpress to new domain - move wordpress to new host - how to move wordpress - move wordpress to new domain - wordpress move blog - moving wordpress site - moving wordpress to another domain - move wordpress to another domain - wordpress move - migrate wordpress blog - move wordpress site - wordpress domain change - change wordpress domain - moving wordpress to a new host - moving a wordpress blog - moving wordpress from one host to another - how to move wordpress blog to another domain - moving wordpress domain - moving wordpress database - moving wordpress to a new server - domain wordpress - move wordpress to a new domain - moving wordpress blog to new domain - move wordpress domain - wordpress new domain - changing wordpress domain - wordpress moving - how to change wordpress domain - wordpress blog - how to move a blog - migrate wordpress to new domain - wordpress move server - move wordpress - move wordpress to new server - move wordpress new domain - move a wordpress blog - move wordpress install - transferring wordpress to another domain - moving wordpress - how to move wordpress to another host - wordpress changing domain - change domain wordpress - how to move wordpress blog to new domain - wordpress domain migration - wordpress migrate - how to move wordpress to another domain - move wordpress blog to new host - moving a blog - how to move wordpress domain - change wordpress of domain - move wordpress database - wordpress move to another domain - moving wordpress to new host - wordpress migrate domain - moving wordpress blog to new server - moving wordpress to different domain - move wordpress to a different domain - wordpress change blog url - migrate wordpress to new server - migrating wordpress to another domain - wordpress moving site -