How to Move WordPress Blog to New Domain or Location / Directory

»»»How to Move WordPress Blog to New Domain or Location / Directory

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 to or the blog to another directory location (such as from to, 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.

Basically, you move or migrate WordPress website via the following steps:

  1. Make a complete backup of the site, all files and database.
  2. Log in to the site to be moved, and go to Settings -> General.
  3. In the text box for WordPress Address (URL):, change the address to the new location of main WordPress core files (e.g. to or to
  4. In the text box for Site Address (URL):, change the address to the new location which matches the new WordPress public site address, which is most cases, will be similar to WordPress Address.
  5. Click Save Changes. At the point, you may encounter 404 Not Found page.
  6. Download all files of the existing site.
  7. Export the database – through plugin, MySQL, phpMyAdmin or any other tools.
  8. If you’re moving to a new server, edit the wp-config.php with the new server’s MySQL database name, user name and password.
  9. Upload the files to new server, or move them to new location / directory.
  10. Import the database on the new server (not applicable if just moving to new location / root folder).
When moving WordPress website, wp-config.php should be no changes, and .htaccess file should be also no changes, especially if you’re not making manual or advanced changes to them. 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.

If you didn’t change the Site Address and WordPress Address prior to exporting the database, the first thing to do 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 or site location. 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, '', '') WHERE option_name = 'home' OR option_name = 'siteurl';

Replace with the old site address and with new site address.

Once you’re done, you should be able to login to the WordPress Dashboard and admin backend through or

Some steps that you should do now:

  1. If you are WordPress moving involved changing of directory (for example, from / to /blog or vice versa), and you’re using Permalinks, go to the Settings -> Permalinks panel and update the Permalink structure to .htaccess file (no change required, just hit Save Changes will do).
  2. 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, '','');

    Replace with the old site address and with new site address.

    Changing URLs in GUID will cause all posts to appear as new in RSS feeds. Changing it is NOT compulsory.
  3. 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, '', '');

    Replace with the old site address and with new site address.

  4. Menu may still have old domain or old subdirectory embedded in them. Go to Appearance -> Menus to update them.
  5. The file’s permissions may have changed. If any files have permissions with “0000”, change them back to “0644”.
  6. For seamless transition without downtime, you may want to keep the old site alive and set 301 redirect from old domain / old directory to new domain / new location.
There may still URLs in excerpts, links, attachments, custom fields, meta boxes, comments and others that required to be updated. You can use several plugins to make the changing of URLs easier. For example:

Velvet Blues Update URLs
Better Search Replace
Search & Replace

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.

By | 2017-01-07T00:07:38+00:00 January 7th, 2017|Categories: Web Publishing|Tags: |259 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years.Connect with LK through Tech Journey on Facebook, Twitter or Google+.
  • What's wrong with using the builtin Export-Import functions and then just install a plugin to redirect the URLs?

  • Thanks so much for this! I can't believe this info isn't on already! I've been suffering through all sorts of 404's ever since following those instructions!

  • Pingback: Technomestique » Blog Archive » Déménager son blog WordPress…()

  • THANKS!!! I thought I screwed things up royally by trying to organize my domain (and my life). This saved me.


  • Thank you so much for the above instructions. You just saved me a lot of time! Much appreciated.

  • Samuel

    hey, i followed these instructions, but wordpress now just wont display anything. i get a white page when opening index.php… anyway, i can display single pages with example

    strange is that i won't find any php errors, httpd errors or anything alike. any suggestions?


  • These SQL statements made my day a lot easier. Thanks!

  • You rock and fixed my site. Gracias.

  • Samuel

    i disabled all plugins, and the site worked again. maybe this helps. bye

  • To fix images path after moving wordpress to another domain or directory you need to update wp_postmeta and wp_posts so that every link related to posts link to the new wp_content location. We need to do a find and replace in some tables of the database. Using phpMyAdmin You could use the following SQL code to search and replace de links.

    UPDATE tablename SET tablefield = replace(tablefield,"findstring","replacestring");

    One example would be:

    UPDATE wp_postmeta SET meta_value = replace(meta_value,"","");

    UPDATE wp_postmeta SET meta_value = replace(meta_value,"","");

    or the other way round depending on your case… (this was mine – changed to account root)

    UPDATE wp_postmeta SET meta_value = replace(meta_value,"","");

    Note: You can use similar expressions to change links for "wp_posts" table, in this case the field to change is "guid".

    Note: In my case I had to Update Permalinks in WordPress Admin->Options->Permalinks to update global linking.

    IMPORTANT: Before changing any table fields look carefully at the field values of the tables in the database so you can decide what values to change.

    This solved my migration of wordpress because after changing files to the server account root directory everything was pointing to the old URL.

    Hope to help, I know what you guys are going through! I had this problem a few days ago.

    Sorry if my English let You down but I'm just a poor Computer Engeneering Student from Portugal 🙂 Have a nice life! Peace!

  • Hey again! Forgot to mention that I also had to change links to images inside post content!
    Like this:

    UPDATE wp_posts SET post_content = replace(post_content,"","");

    The method is always the same, find the old link in the table fields and replace by the new one.


  • soul

    this occured to me after moving from one webhost to another. i couldnt login as admin.

    tried alot of the cheap fixes but the cheapest of all worked:

    be sure to delete emergency.php after yer done!

  • Thanks for this article.

  • G

    A really great help after moving my wp-installation. Made my day 🙂 Thanks

  • Thanks for sharing how to move WordPress blog to new domain or location.

  • they had the wild playing still there. work visit little done it. let it go. reminded damage the forests

  • thanks for sharing this howto

  • An easier way to replace all occurrences of your old domain name is to export your database into a text file using phpmyadmin or a backup plugin, then use a text-code editor to find and replace all occurrences of with

    Import and voila!

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

  • 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!

  • 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?

  • 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!

  • Pingback: scriptygoddess » Blog Archive » Moving a Wordpress Install()

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

  • 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.

  • Nikhil George

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

  • rebel

    yes there are open

  • 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

  • NAthanT

    Gold information.

    You saved me hours.



  • Piotr

    great info 🙂

  • Pingback: Smuggle Me » Export One Wordpress Blog Category to Create a New Blog()

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

  • Pingback: Mudanza del blog |

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

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

  • Thanx for that , its help me soooo much

  • Pingback: alex robinson » Blog Archive » Migrating mom’s wordpress()

  • wow, thanks for the information..:)

  • 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.

  • Thank you! You're a life saver!

  • Great effort of providing latest Word Press information.

  • 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.

  • Pingback: how to move a local wordpress to live blog? | Blog Design Studio()

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

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

  • 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.

  • also one might have other places that mention the old url, so this plugin could also help:

  • 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 🙁

  • TauAs

    Thank you very much! everything works perfectly.

  • It's perfectly working!

    Thanks a lot!

  • Thanks man. Everything is working again! 🙂

  • 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.

  • Flip

    Thank you very much!

  • Pingback: Migrasi Lagi… « —-aulia_ra—–()

  • ERay55 hi! how you doin?

  • Blake

    I tried to enter the code, but kept getting errors. what did i do wrong?

  • Hayley

    Hey this has helped me so much! Thanks!

  • Jørn


  • Thank you very much, following your directions helped me to make the migration without any trouble at all.

    What surprised me most was that all my plugins worked right away as well! I was expecting trouble there, especially with NextGEN Gallery.

  • Thank you very much. I've successfully move 2 blogs by referring to this tutorial. Thanx to the writer of this post.

  • Pingback: memo: change wordpress domain name « Konstantinos Koukopoulos()

  • moin

    You have said that "Note that this guide is not about how to move WordPress blog from one server or host to another new hosting service." But if I want to do this how it is possible. If you have any solution please reply.


  • Any one knows, what happens when the destiny domain is a IDN domain (forofundacionserranosuñ I am having big problems and maybe this is why?


  • Pingback: WordPress Blog zu neuer Domain verschieben | Dirks Blog()

  • I think 2 more queries should be added. Many people use additional fields to store queries for thumbnais and there is also info about attachents.

    UPDATE wp_postmeta SET meta_value = replace(meta_value, '', '');

    UPDATE wp_postmeta SET meta_value = replace(meta_value, '/home/old-domain/public_html', '/home/new-domain/public_html');

    * This last one may depend on the host home directory and structure.

    Long life wordpress! 🙂

    Cheers, Alex from spain

  • Pingback: How to transfer a big wordpress blog?()

  • Dan

    worked perfectly. one thing to consider is you have to be patient. it took about 15 min for the changes to propogate even after i cleared my cache. i know it makes no sense but thats the story!

  • Thanks, this helped me a lot. We are currently moving 2 WP-blogs to a new location.

  • susan

    Wow, thanks! I was really afraid to do this (without knowing if I was doing it correctly), so I just decided to go for it and copy-paste 1-2-3. It worked! Note: also, I had to go take out the old index placeholder file I had up there at the designated location. Once that was out of the way, it all showed up.

    many thanks again – most helpful!

  • Dan

    Great stuff 🙂

    Clear and easy to follow, just how a help page should be. Bookmarked for future reference.

  • Great guide here for managing WP sites. Many thanks!

  • Niels

    This was a great help to me, thanks! I'd just like to add that in WP 2.7 I also had to got to settings>permalinks and hit the save button again to reset those (I'm using 'pretty' permalinks.

  • Excellent post, thanks for sharing, you've just saved me loads of time messing about

  • 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 to 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 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

  • Alex

    works perfectly. thanks!

  • March

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

  • 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.

  • Pingback: How to Move a Wordpress Database | Always Get Better()

  • 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

  • Thank you. This worked perfectly. =]

    All I did was copy and paste. =]

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

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

  • Phantom Paul

    Brilliant – worked perfectly – many thanks !

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

  • Thank you. This worked perfectly.

  • Just moved my blog to my new domain

    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 and and that is all that you will need to do.

    Andrew Kolyvas

  • Jez

    Thanks Great Help

  • 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.

  • Thanks so much for this!

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

    Why ??

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

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

  • worked perfectly – many thanks !

  • Тhank you very much, very useful info.

  • kelly80321l

    I just moved 3 of mine using this guide. Made it easy for me. thanks

  • 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!

  • thankyou for the nice and helpful information.

  • 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.

  • 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 Would the above technique convert those links quickly once the WP blog is hosted? Cause right now I'm resorting to cutting and pasting…

  • lifesaver! thanks for this, have been scratching my head for a week or so trying to solve it on my own.. thanks

  • Pingback: Migrace Wordpressu na jinou doménu | Milan Knížek | fotografie, linux()

  • Pingback: how do i change the domian of my blog , just bought a new..()

  • Great Post, saved me ages, many thanks!

  • man, you rock. This just saved me an hour of head-banging. worked like a charm the first time.


  • Thanks for the info – don't forget to post about the Australian domain name industry – it's really starting to take off… Thanks again

  • Pingback: Moving to new domain – Saved for later reference()

  • thx a lot. It seems a lot easier than I thought. Implementing this on my blog was quicker than writing my post above.

  • 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.

  • 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.

  • Jon

    Just wanted to say, thank you – this post was a big help.

  • samuel

    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

  • thancks
    this post very very helped me !

    Good Time

  • Thanks for making this tutorial, now my problem is solved. Thanks.

  • Mike

    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.

  • Pingback: How to bundle plugins into a new WP theme()

  • Thanks for the tips !

  • Thank you for this advice. It really helped me.


  • It's it not necessary to do anything in database for migrate the url to another domain.

    There is another way with this simple steps.

    1. change Blog address and WordPress adresse (Url) in your general settings -> safe changes

    2. go to settings -> permalinks do nothing and save changes

    so the blog urls been updated.

    please give me a response …

    greetz Markus

  • Thanks so much for the help for me to merge my blogs. You saved me a tonne of headaches.

  • The only issue I found was that the new site keeps trying to upload media to the old site. Is there an easy way for me to change this? Where would I look?

  • I just want to say thank you very much for this article and for your time creating these SQL statements.

    Can i say I Love You?!?! haha

    Kelsi Guidry

  • Joel Lundgren

    Thank you..
    Now I can sleep again..

  • There is nothing I could find on the WP codex that describes these completely essential steps of the migration process completely. Also, the MySQL commands is by far the most difficult bit to understand. Awesome stuff and thanks. I followed your steps and it works (and I understand it too).

  • nice article !

  • Williecoetzee

    Thank you! Thank You!

  • Many thanks for a great article, just what I was looking for. You might like to add a footnote for those who use relative paths in their blogs for internal links to simply search and replace on the relative path in exactly the same manner as your search and replace method for absolute paths.
    Once again many thanks, Phil at KingSolutions

  • You also can use WordPress Domain Name Changer plugin

  • Thanks for this, it was really helpful. Especially the bit about changing links to my own blog—I hadn't even thought of this issue, and now I won't have to.


  • It is very helpful.

    Thank you very much.


  • very helpful…thanks

  • Thanks for the write up dear ….

  • … the replace command is taking FOREVER for me : 20 minute so far. Is something wrong?

  • ari sihasale

    haii.. nice post kawan…

  • Excellente information ! Mille mercis.
    Great post.

  • Andrea

    This was extremely helpful information. Thanks!

  • I am trying to move my blog to another subdomain on my domain, i copied everything to the new folder and run the SQL queries you say in here, but it gives me an error I have no idea what it is because I no almost nothing about PHP.
    TDOMF ERROR: Headers have already been sent in file /home/edad3/public_html/ on line 18 before session_start() could be called. This may be due to…
    Your current wordpress theme inserting HTML before calling the template tag "get_header". This may be as simple as a blank new line. You can confirm this by using the default or classic WordPress theme and seeing if this error appears. You can also check your theme where it calls "get_header".

    I have seen the files they mention and still don't know what to do. Can anyone help me? I am using WP 2.8.6 with some plugins.
    Right now I changed back to the old subdomain because there everything works fine. I don't understand how there could be a problem since I copied the files from the old subdomain to the new, so everything is the same.

  • Was clear, and it worked perfectly.

  • Steve

    Will this work with wordpress multi user too?

  • Very clear and concise, this helped tidy up some SQL server moves.

  • anonymous

    WOW! Worked so good! THANKS! How did you figure this out? Google?

  • Saved my sanity. Thank so much!!!

  • Michael Scott


    Completely made my day! Took me all of 30 min to migrate everything to a new domain name.

    Good on you mate!

  • luk

    thanks! really helpful
    would just like to add a reminder about the upload_path field in the wp_options table

  • bolsas femininas

    Enjoyed reading this one.. tried the to add this website to google RSS reader but it didnt really work, any ideas?

  • Yash

    Worked for me..!!! Thanks..!!!

  • CSS Coder

    As a theme developer, I need to move wp sites to and fro between localhost and production server. This article saved my life! And I can't count how many times I've visited this page in past.

  • serhat

    wow very nice thanx

  • sam

    Very good, save the good thing.

  • Kim

    Thank you so much for the instructions. Worked perfectly to move my goddaddy site. I really appreciate this excellent resource and have subscribed.

  • Luis

    Saved my life! Excellent guide. Many thanks… you are a gentleman and a scholar.

  • Kodama

    Do you bother with the settings > set default url or just run the MySQL commands to change a domain name?

    I backed the whole thing up with WP-DBManager 2.50 and my new domain already points to the blog. Just nervous about following the commands to change to new URL. Nothing else changes, not moving just using new domain..

  • Firman

    Very helpful. Recently I moved my wordpress blog to a different domain and all links broke, styles were not applied, etc. Thanks for sharing this.

  • Tom

    You saved me on this one, pal. Thanks!

  • David Radovanovic

    Thanks. For around the fifth time, I used your guide to successfully move various WordPress websites. 😉

  • miso2004

    Thank you !!! You've saved my life!

  • miso2004

    Thank you again! Good advice. Saved my life.

  • Dave

    Thanks for this, it really helped me out!

  • majalah

    I have trouble setting image URL when moving to new host. thanks for the guide. It makes me clear.

  • Jonas

    Great, now it works for me! Don't forget though, if you are using a subfolder where the name has changed, like, you may have to change the .htaccess file in the blog root directory.

  • Tim Gagen

    Thank goodness for this post! Finally someone who actually knows what they are doing. I got incomplete instructions on this for the past 2 hours. Great value, great post.

  • Annie Boga

    Greeting to you from Seattle, great article, lots of help, tnx 🙂 xoxoxo

  • Todd

    Great share, keep it coming!

  • Arata

    Thank you for posting this guide.
    It helps me moving my wife's site to a new domain.


  • Joseph

    Thanks for this guide it really helped me 🙂 I was so desperate in the start…i thought i lost everything and now my new blog is up and running without any changes/problems.Thanks a lot.

  • Fahad

    Who ever you are man,,,

    I really thanks ful to you,

    You have solved a real problem , till yet this is the only solution which works for me.

    May God reward you

    Once again thanks alot brother

  • Ahiaruhe

    You're a lifesaver mate!

  • TexasLaw

    Just letting you know you helped someone else out!


  • Nehemoth

    Hello, First I know this post is old but still, maybe someone is watching it.

    I'm trying to prepare myself for a future host from host migration, so I want to do the testing locally, so I've done all that is listed here.

    Done the wp-content backup
    Done the DB backup
    Create a New DB
    Create a New user
    Set permissions to new user
    Restore the downloaded DB into the new database
    Installed wordpress
    configure wordpress
    update via commands the new domain and all stuff

    The connection all went just fine, but no one post appear, no information in the blog.

    I know I can do an export/import via wordpress but I want to do it via the SQL DB (hard) way.

    BUT i know I'm doing something difference which I do not know if should be done in this process :

    First I installed wordpress on IIS (just for the sake of learn how to)
    Second I'm using a different version of wordpress from the actual blog. I have wordpress 2.9.2 in the production site and wordpress 3.0 RC1 in the development site.

    As I said before, my problem is that after I did everything as told me by every guide that I could find, I can not see the information even as the site is working.

  • Nehemoth

    I found my problem, as the time have passed by, I have multiple tables, so my Table_Prefix should be set to the correct table set.

  • Sebastian

    One more thing, also make sure to change all the directory references when moving the blog, if the blog is installed in a new sever in a different directory you must update that too

  • Smee

    Sadly, the command:

    UPDATE wp_posts SET post_content = replace(post_content, '', '');

    ended up replacing the entire post contents.

    Then mysql database backup never happened, so it screwed me over. 🙁

  • vickie

    Great info on all the stages, thanks!

    If (like me) you're not entirely comfortable working directly in the database

    is a really good plugin that does this part of the job for you so worth checking out (updated for 3.0)

  • Shovan

    You should do this as well

    UPDATE wp_options SET option_value = replace(option_value, '', '😉

    this will replace other url in the option table

  • Tony


  • Arnie

    Has anyone tried this with the new wordpress version 3.01?

  • I tried this. However, it failed. Is the theme you are using also involved? After moving the sight it was as if the CSS style sheet wasn't detected.

    I urgently want to move my sight to a new domain. But I haven't found a way to do it that works. I'm using WordPress 3.01 and the Magazine Premium theme version 1.1.2.

  • Bakos

    cool picsxx

  • Andy


    the only way that command would've replaced the entire post contents would be because you made a typo. The syntax is absolutely correct, and I have performed this operation multiple times without issue.

  • El at Tantalizing St

    Hello and thank you so much for these directions. It worked wonderfully to move my elephant dance blog.

  • Server Migration

    Thanks for this tutorial it really helpful…Thanks a lot.

  • Pingback: How to Move WordPress & Change The URL | Coyote Mercury()

  • Carie

    Thank you God for posting this. Once I figured out how to not get that No Database Selected error I was good to go. Saved me sooo much trouble. Thanks so much. Amen.

  • Jasper Tey

    Thanks for the article; saved me a huge hassle in trying to figure it all out myself!

  • empty

    Good work ! Very useful.

  • John

    Perfect. This made modifying some 500+ records about one minute of work. THANKS!

  • Krystle Notoma

    good post

  • khadijah

    how do I enter a domain name on our blogs

  • mala

    i have a new blog but i dont know how to use domain in my free blog

  • Emanuel Dávil

    thanks!, saved me 🙂

  • Tom

    Very good post if you want to take the time and do this manually. I can do this for you or there is a real easy way that this can be done in under 5 minutes if anyone wants to contact me. I can help if someone doesn't want to do this themselves.

  • thomassabo-charm

    Great!very helpful!thx!

  • Daniel Doezema offers a script that helps migrating the website to a new domain:

    I've added MU support to that script, which is available for download here:

    For MU, after you run the script you must also update your wp-config.php and change the constant DOMAIN_CURRENT_SITE to the new domain.

    NOTICE: My MU version wasn't tested a lot, so BACKUP ALL YOU DATA before running it.

  • Bilal Ahmad

    I have a question. As the blog in my hostgator is installed on old domain. How will the hostgator recognize that the blog is now on the new domain. And we have to change DNS setting for the new domain or not.
    We have to just add the new domain in hostgator and then follow the above steps. Is it Ok?

  • ta

    Great! Thank.

  • krembo99

    Thanks, those commands saved me a whole lot of work !

  • adam

    i used the raw way to transfer my wp 3.0.1 to another server, with the same domain name (repoint dns server, create addon domain, bla bla bla).

    1) backup mysql, the raw way. (the .sql file)
    2) transfer files, the raw way. (ftp, nothing else)
    3) move to new site,

    i. mysql -u blabla -p db, save it. Back to the same column, remove www, save it again. It somehow update somethin and save my day. hope this is useful to others.


  • adam

    sorry for the triple thing. the post with "please remove earlier comment" seems messed up. just use my very first post. sorry for the problem caused.

  • Toyin

    This was very helpful. had to edit wp-config with the new database details and worked perfectly after that!!Thanks

  • Captain Howdy

    Absolute lifesaver, this worked perfectly!!

  • Locksmith

    I am beginning a blog for my organization and found the article quite useful. Thanks for the ideas!

  • Deb

    Has anyone tried the plugin WP Migrate DB? I might give it a go.

  • em

    Did not work.. I still cannot log in to my admin… I get no web page at all here..

  • Brandon Kitajchuk

    Wow, thanks man! This worked like a charm 🙂

  • Brandon Kitajchuk

    The only other thing I needed to do was update the new domain in wp_links table under the link_image field.

  • Avi

    really helpfullll…

  • shiroku

    great script, i have changed manually the database but it didnt work, now i use this script everything works..

  • Alientyc

    useful mysql statements even today for wordpress blogs! 🙂

  • Gary

    Thanks for the SQL scripts. It's definitely worth running the scripts for both '' AND '' just in case some URLs contain (or don't contain) 'www'.

  • formulablo

    nice share, after all step above, goto admin and upadte databse… dont forget to activate plugin and theme

  • Toyin

    Thanks so much for this very helpful guide.

  • rahul

    Thanks for that article… after that i cant able to login in my wordpress please help what was wrong ?

  • Christine

    You are a lifesaver. Thank you so very much for this helpful guide. Cheers!!!

  • estrenos 2011

    Thanks so much for this very helpful guide.

  • My Sovann

    Very complicated guide, My english is also not good enough then leading to more and more difficulty to reach the destination. Actually, it quite good info.

    I'm still looking forward to getting help from u.

  • Weavr27

    Thanks so much for this guide. It was very helpful. I am able to get into my wp-admin again!

  • Bobby

    Thanks a bunch for this.

  • Vab Media

    This is a great guide! I always refer back to this when I need to do a migrate a wordpress site to a new domain. It's so easy to do!

  • Dave Y

    hmm… I executed all the steps above, and it did work pretty quickly. A couple of things.

    I think you need a database export(sql) from "old-site" and imported to "new-site". My ISP had an FAQ on doing this at their site. I executed the sql updates above and all my links were converted -except- links to my blog posts within blog posts.

  • Haris

    Very helpful post,
    really helped me
    thank u very much.

  • reader

    Isn’it possible to avoid absolute links in a WP site ?
    HTML propose 2 cases absolute references or relative.

    Why not use ONLY relative links ?

  • J

    Thank you for the guide, worked fine!

  • SHE43P25UC

    Thanks for the great tips!

  • jsml

    THANK YOU SO MUCH FOR THIS. I looked in a million other pages for solutions and this finally did the trick.


  • David Bressler


    Thanks for the well written explanation. However, I still have a question.

    My server isn't moving, I just want to change the root URL from to Everything else, remains the same, the server remains in place.

    In fact, I still own both domains, today I redirect to

    What I'd like to do, is redirect to, so that my branding reflects the new domain name.

    Since the old domain will still work, any old hard-coded links should still work.

    Therefore, my question – is all I need to do to make this work, change the the WordPress and Site Addresses in General/Settings to the new domain name from the old domain name?

    I shouldn't have to change any of the existing hard-coded links (like you mention above) because I still own the domain and am redirecting. By the way, it's a new site, so I don't have much google search history that I care about, so any performance hit or search engine optimization I lose is OK in this case.

    Thank you,


    • Dave Y

      Dave B.,

      I don't think so, especially if you're using permalinks. After following these instructions, cleaning the database, and the control panel, all my permalinks still had all the old urls in them.

      I picked up a plugin called 'search and replace' to police up all the '' references.
      My activity was very similar; same hosting company, same database used the only thing changing was the domain.

      If you just change the admin panel, and follow the rest of the instructions the blog should still work- ours did. But, as I mentioned we had a bunch of dead links, etc.

      Dave Y

      • David Bressler

        Thanks Dave. Sorry it took so long to get back to you. I appreciate the help though.


        PS I've got it moved over, with a little help from my service provider and not very much drama!

  • Buddy Hannon

    Thank you. You took what was going to be 1.5 days of PITA work and allowed me to get it done in 10 minutes!
    You rock!

  • Phi

    I upgrade my wordpress blog (******* to *****.com
    But I don't know how to upload a file onto it.
    I want to use Google Apps for my domain, and it requires uploading an html file to verify.
    Can you help me?

  • Ian

    If you've got phpmyadmin locally, it seems like you're better off to export to an SQL file and then run a simple find & replace on current wp-root and replace with new wp-root. ie: http://localhost/blog with

    Save sql file, import into DB, upload files. Faster and easier than mysql functions and its a one step process.

  • Jeremy Penrod

    I've honestly used this article more than once. Combining those three SQL calls into one fell swoop makes transferring a WP domain literally take 30 seconds.

    Thanks for posting this.

  • DNS Lookup

    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.

  • bubbles

    For some reason when i copy and paste it tells me that i have a problem with the syntax?! anyone got that as well?

  • Kilian Güntner

    Thanks! Great tips, swapped domains in just a few minutes

  • Ola Löfv&eacute

    Great guide. I also put up a guide, and recently moved a few installations when changing webhost. Perhaps your guide is a little easier to read 😉

  • Rosana

    Hi, thanks for the instructions, it worked half the way for me. The index looks ok but when i click on a menu button to go to a page or post i get an error like the page doesn´t exists. Any idea ??

  • Markyboy

    Fantastic info got me out of a very tight copy over/ install dead end. Best wishes to my friend!

  • Demian

    I am trying to move one DB (named wktdatab01) to another site, wich already have one DB empty (named dignadatab).

    But I can´t as it seems that this different names are affecting it. How can I solve this? and import the tables from wktdatab01 into dignadatab ?

    Thank you!

  • Thanks for your info and this is working fine and I would like to appreciate for your some very important article which I got just on this site

  • csj

    Very useful and thanks this helps me change domain name easily.

  • Nasko

    Great tutorial! Use it!

  • Great write up guys you saved my life with this. Thankyou thankyou thnakyou!!!


  • Thanks A Bunch!

    Great Trick to have under your belt.

  • Hi,

    thank you very much for this tutorial!
    has worked fine for my domainchange.
    very helpful if you want make an update for previous testing.

    kind regards!

  • AJS

    THANK YOU!!! This saved my life, I cannot even explain.

  • Cody

    This worked for my photo gallery, so glad I found this.

  • Aryeh Beitz

    Just click Tools -> export. it will save the entire site into an xml file.
    then in the new site, do Tools -> import. viola!

    • Daniel

      Well, now i have used your site the past 2 years to move my blogs (i always check your site to copy/paste your code in sql) and THIS is the best and fastest way to move your WordPress.

      So thanks for your article. (just want you to know)

      • Pablo Karzin

        Me too. I have used your site for the past 3 years

  • edekzkrainykredek

    you shouldn’t change GUIDs,

    it will confuse feed readers associated with your site because they use GUIDs to distinguish posts from each other

  • rachel

    I tried this but I’m not sure what database I need to be in? And when I try entering the code I recieve the following error message
    “1146 – Table ‘rsydowde_04_02_2012.wp_options’ doesn’t exist”

  • Jared

    Nevermind… I just needed to update my permalink structure. *phew* I thought that was going to be a lot harder… ^_^

  • francesco

    I suggest you the WP-Migrate-DB plugin! Veeery easy!

    • Picha

      Abe chutiye

  • Flip

    kya chutiyappa hai

  • Michael

    Thanks 🙂

  • ZedByron

    Saved my life, man! If you ever need a pint of blood, type 0-, please, reach out!!!

  • sanju

    realy helpful thx a lot

  • Matt Robinson

    Thx so much. Not sure how/why/when my DB reverted to the old domain for some rows but this helped me fix it within 10 minutes of discovery. Great post!

Pin It on Pinterest

Share This

Share This

Share this post with your friends!