Steve Taylor photo

Moving WordPress to a new domain or server


WARNING! This post isn’t really for beginners. In any case, please back all your stuff up comprehensively before trying anything out. If you don’t know what you’re doing, things could go quite wrong.

NOTE: I’ve not tested it yet, but check out the WordPress Move plugin – could help if anyone needs something a little more user-friendly than the process documented below (although knowing what’s going on behind the scenes can only help!).

This post has been translated into French by Jean-Guy Grenot.

Moving WordPress’s location—be it to a new domain, a new server location, or both—has never been as easy as it might be. Here I’m going to document my own process for achieving this, and try to keep it updated with new ideas and lessons learned.

Please note before starting that I’m concentrating here on the WordPress-specific side of this process. For anything not related to WordPress regarding moving domain or server, you should probably check with your domain registration service or web hosting provider.

1. Lock out all users

Firstly, you should prevent any users from accessing the site. This is so you don’t get any content / comments / etc. submitted after you export the database.

Generally I’m in the situation where I have to move a WP installation from a development domain to a live domain, so this has little impact; but it’s worth doing so anyone adding content (e.g. your client) doesn’t lose work.

If you’re moving a live site, you might be looking at a bit of down time. I won’t be going in to the more general ins and outs of moving a live site for now (sorry!).

There are probably, ooh, umpteen ways of locking users out elegantly. My preferred method is using my 503 holding page, with a filter for my own IP address. If you’re not comfortable with .htaccess the Maintenance Mode plugin should help.

2. Back up files

If you’re moving the location of your files on your server, you’ll need to pay attention to this. If you’re just changing the domain, you may as well back files up, but it’s not necessary.

You can be blunt about this and literally back up all files, but really these are the only WP files that are unique to particular WP installations:

  • /wp-content/ (everything in this directory)
  • /wp-config.php

While not standard WP files, these are common files that might also be specific to your installation:

  • /.htaccess
  • /apple-touch-icon.png
  • /favicon.ico
  • /robots.txt

For any of my clients using my installations, these files also need saving:

  • /503.php

See also: A more detailed guide to WP files.

3. Back up the database

The database contents have to change whether you’re moving server or domain.

You can do this using the WP-DBManager or a similar plugin, or via phpMyAdmin (accessible through your host’s control panel).

Here’s a sample phpMyAdmin Export screen showing typical options you’ll need to select:

Exporting a database from phpMyAdmin

4. Make file changes

Do a global search through the site’s files for instances of the absolute server path and/or the domain. Most good editors can search through multiple file contents.

Until you’re familiar with the process, it’s best to check each instance before replacing it.

Replacing the server path

Here’s some places where you might find the absolute server file path if it needs changing:

  • /.htaccess (I usually have some .htpasswd protection ready to roll just in case, and the path to that file will be here.)

Replacing the domain

Here’s some places where you might find the domain if it needs changing:

  • /.htaccess (I usually have a bunch of things in here that need the domain hard-coding: redirects, rewrites, no-www stuff, etc.)
  • /robots.txt (For me, usually a reference to the XML Sitemap.)

5. Make database changes

Here’s where the fun starts!

I’m joking, this bit’s a nightmare. At least, it can be a pain.

You’ll probably need to alter the database contents for any server or domain change.

Character encoding

I still occasionally make a mistake here, but basically you need to check if your database tables are set to UTF-8 or not. If they are, make sure you do any editing of the database export file in an editor that supports Unicode files. I know the latest Dreamweaver and TopStyle do. TextPad does; I think even Notepad does these days, so this might not be as much of an issue as it used to be. (Though Notepad is probably best avoided. Its search/replace won’t be up to the task here, and my experience of it working with multi-megabyte files is patchy.)

I’ve not tried any of these solutions out, but the ace WP developer Vladimir Prelovac has a page and a plugin aimed at solving problems with UTF encoding in WordPress databases.

Anyway, because of character encoding and for other reasons…

Keep an unchanged copy of your original database backup file

Just in case…

Then, import the database into your new server via phpMyAdmin.

Tackling serialized data

WordPress, and some plugins, often store settings in the database using serialized arrays. What’s important here is that this data format will store, alongside a string of characters, the length of that string. If you change the string to something of a different length, it won’t match the stored length, and the data will be corrupted.

The Search Replace DB script (by Dave Coveney) is a good tool for helping with this. Once you’ve imported the database to the new server, upload this script to the web root and run it in your browser, following the instructions. Use it to replace the domain the site was previously on with the new domain, in all database tables. It should intelligently handle all serialized data. Obviously, back up before trying this! And don’t forget to delete the script from the server once you’re done.

7. Get the new site going

Now you’re pretty much set.

  1. If any database information (name, user, password or host) is changing, update the new site’s wp-config.php file appropriately.
  2. If you’re moving the files, upload them to the new location. If you’ve only backed up the installation-specific files, upload the other WP core files as well, taking care not to overwrite any of your customized files (especially the /wp-content/ directory).
  3. Do whatever you need to switch the domain over, change the DNS, etc. I can’t help you with this bit if you don’t know what to do—ask your server admin.
  4. Test the new site before removing whatever method you used to lock other users out!
  5. If you’ve moved your files, you might need to check file permission-related areas such as:

I hope this has all been of some use to you. While I can’t provide support for basic issues, and certainly wouldn’t recommend a beginner trying all this, please let me know any better ways you have of addressing the same issues, helpful plugins, corrections, etc. Thanks!


  1. Devon Woods avatar Devon Woods

    Hey Steve! I have been looking for some instructions like this but I want to be sure it will work for my situation which is …I currently have a blog at [URL removed]. I just purchased the domain [URL removed] and it is pointed to the same name servers as my [URL removed] domain. FYI …I created [URL removed] as an addon domain at [URL removed]. If you are not familiar with addon domains …An addon domain allows you to reach a sub-domain when entering the name of the addon domain into a browser. This means that you can host additional domains from your account, if allowed by your hosting provider. Addon Domains are relative to your account’s home directory.

    Will the above process work for me to move [URL removed] to [URL removed] ? or would the procedure need some slight modifications to work for my situation?

    Thanks, Devon

  2. Steve Taylor avatar Steve Taylor

    Devon, in brief, the above should work for you, but I can’t make any guarantees – it’s all very “as-is”.

    I was in two minds whether to spam you though. Watch out when you post super-simple questions infested with repeated URLs!

  3. Huken avatar Huken

    Thanks this post! I want to move my blog to new server…

  4. Hello, thanks for the help! But me I had another problem, it was not the number of characters but the conversion of single quotes to double quotes. I had to do it manually because the solution by Dave Coveney didn’t solve my problem. Bye bye

  5. Brandon avatar Brandon

    Hello, do you have a “how to” video guide to follow? I am a complete newbie and I want to change my domain name and reading the above really confuses me. Any extra help would be awesome.


  6. Steve Taylor avatar Steve Taylor

    Brandon, sorry, I’m too busy. Do read the warning at the start!

  7. Hmm, I went through similar headache moving from blogger to blogengine. I think key is to know your indexed links before the move, setup 301 redirects on new home.


  8. hi,
    i got this problem. I have a blog which i transferred to a different server but same hosting company. the blog was under a subdomain previously and now i’ll be assigning it to a domain. I have already updated phpmyadmin under wp_options, change the URL. already udpated my wpconfig.php pointing to the right database. The things its pulling up a previous permalink which I use previously (the I’m quite confuse, what I mess up and I dont know how to have this work. Please let me know what to do.

  9. Gale, have you searched the database in phpMyAdmin for the old subdomain? You need to replace all instances of it with the new domain—but mind out for the problems described in section 6 of this post. Good luck!

  10. I was able to place my site, but images are not showing up. Its pointing from a previous path, is there a way to point it to the updated path?

  11. Gale, I’m guessing the images aren’t showing up because their URLs (in the img tags’ src attributes, in the post_content field of the posts table) are still pointing at the old domain. You need to replace every instance of the old domain in the database (in every table) with the new domain. As I said, though, note the caveats in section 6 above.

  12. 花蓮民宿 avatar 花蓮民宿

    It’s really helpfull , just plan to move my wp blog to new host , thank you very much.

  13. Thanks, we’re considering moving from BlogEngine.NET to WP to avoid spam, and moving hosts was a big concern for us. Not any more!

  14. I’m doing a backup recover test restoring the site on my localhost (files and database). After restoration and editions I can see the posts with no problems, but after the login a blank page appears and I can’t administrate the recovered site.

  15. Halley, I’m not sure about this issue but I think it’s “known”. Try Googling for “wordpress login blank” or something. AFAIK it’s unrelated to the measures detailed in this post, but let me know if you find that it is.

  16. Hi Steve,
    I renamed the child theme folder, changed the theme to the parent theme, renamed the the child theme folder to its original name and changed the theme to the child theme. It’s all ok now. Thanks!

  17. Andy Baker avatar Andy Baker

    Steve, I am having problems, the front end works just fine but in the admin, I am either not getting past the login screen or getting a “you don’t have permission…” error message.

  18. Andy, I’m afraid I can’t really help without more precise details. Try searching the forums on, this issue sounds similar to one that’s quite common, and dealt with in several threads there.

  19. Andy, regarding dealing with serialized data, check the post by Dave Coveney I linked to. I myself don’t really use scripting for this.

  20. hello there..everything went well when i moved the site and its up running nicely..
    i have one big problem though..i cant get in to my admin page in any way..i get the log-in page and change the password and seems to accept it and notice when passowrd is wrong.. but after clicking “login” i just get blank page, and nothing happens..
    anyone that can help? would be really grateful

  21. Hi Jonas, I don’t think this problem’s specifically related to the instructions I’ve given, but I think it’s “known”. Try Google or the forums. Good luck!

  22. Joe Angrisano avatar Joe Angrisano

    Hi Steve…

    This is not my cup of PHP but here goes.

    We have a dedicated server with Hostgator… cpanel and WHM admin for the server.

    We would like to duplicate/mirror an existing wordpress website on the server to a different URL and wordpress installation on the same server, preserving all content, custom design etc.

    We will address the problems with mirror sites at a later time and change the content.

    Any help would be appreciated!


  23. Hi Joe, I think all the help I can offer is in the above post, unless you have a more specific problem. Best of luck!

  24. Darren avatar Darren

    great help, man! Finally I got my wordpress moved to a new domain and new server at the same time. you saved my day.

  25. Jim avatar Jim

    Thanks for this! I was looking for an easy tutorial on how to transfer my site (well, relatively easy). I’m at the stage of backing up my database now, I’ll let you know how the transfer goes once I’m done.

  26. Nancy avatar Nancy

    I’m in the process of moving my guy’s blog from GoDaddy to normal hosting (he didn’t know better) and have run into the “You don’t have permission to access this page” on login after importing the database to a new install. Yes, the problem is listed all over WordPress, but the solution is not. In the wp-config.php there are settings that are implemented by the installation and if you don’t have all that information it is a nightmare. GoDaddy took down the site when he transferred domain registrar so there is no current backup and the backup done two weeks ago using a wp db backup plugin only contains a reference to a hosted db somewhere. We downloaded the .sql file from the old host to use as our backup. He was planning to have time to do that before moving, but their abrupt removal of the site although months remain on the hosting means that we have access to the files on the old hosting account, but no WP framework to help backup and export. We installed a new WP install because of not having a complete backup and I got the site visible by removing all the plugins. We can’t access the WP admin (“…permissions”) so today I will uninstall the new install, copy every folder from the old host to the new one and start over. In our case I believe that the new WP install is causing the problems because the old db tables had a different prefix and needed to be manually edited to match the wp-config.php. I think I kept the wrong version of usermeta(?). It would help if either of us knew what we were doing, but I’m trying to stay optimistic. He has close to two years of travel/photograpy blogging that has a nice following and would be utterly devastated if I can’t get it fixed. I appreciate your explanation of the serialized sequences that could be part of our problem.

  27. Thanks Sayooj. Can’t say I understand your method, which makes me think it might not be suitable for non-developers.

  28. Sayooj avatar Sayooj

    Right steve, you need little knowledge of development and little Database knowledge. if you need any help, let me know i can help you out.

  29. Shareef Defrawi avatar Shareef Defrawi

    Hi Steve, I’ve come across multiple vastly different sets of instructions for how to do this as I prepare to make the transition for one of my sites. Many of them claim it’s not as complex as everyone says and it’s just a matter of copying the WP files over, importing the database and changing wp-config and wp-options. Are there any situations where that’s all you’ll need to do or am I better off following the above instructions instead?

  30. You definitely need to replace the instances of the domain in the database, and it’s always worth checking for server paths (depends on your plugins). Unless your domains and server paths are the same lengths on the old and new servers, you also need to account for the serialized arrays.

  31. Melissa avatar Melissa

    I just wanted to say THANK YOU. This was the most comprehensive walk-through that I have found. I have been frustrated the last few hours trying to get my site switched over from a directory to a new domain. I had issues with a few plug-ins, but I just decided I could delete them for now and set those up later since they weren’t vital.

    Success!! YES!

  32. Ray avatar Ray

    Hi Steve,

    I just stumbled across this post as I have been looking for comprehensive directions on how to do this. I see this was written in Aug of 2009. My question is would these directions still be applicable to the latest version of WP 3.1?

  33. Ray, the answer is “probably”. But as when the advice was first posted, YMMV, hire someone if you’re not sure what you’re doing :)

  34. Tom avatar Tom

    Finally someone gave us a clear, direct explanation on how to move WordPress to a new domain! It worked like a charm, finally… Thanks!

  35. CArl avatar CArl

    Thanks for the tip on serialized data. That just saved me no end of time.

  36. Minisite Design avatar Minisite Design

    Glad that we found this post. We’re in the process of moving some of our wordpress based sites to a new dedicated server and I believe your tutorial will really come in handy. Gonna bookmark your post for future reference. Thanks again!

  37. Beto avatar Beto

    Hi, thanks. I came to this tool that helps to check if a URL is redirecting properly in terms of SEO, I think just check 301 Redirect header in HTTP response, but it pretty useful.

  38. P.J.G. avatar P.J.G.

    Hi, before I start, I want to make sure these instructions apply to my situation. I installed WordPress on my WAMP server (localhost) so I could create a development environment.

    Everything worked fine and I was able to work on a child theme for days, until yesterday, when I tried to import a backup (.sql) of the database from the live site so I could get a copy of the actual content from the live version. Luckily, the site does not include a lot of content yet.

    Now all my links point to the live server instead of localhost and I can’t view my CSS edits as I make them if I click any of the links.

    Where should I be doing the search and replace? In the .sql file? Can I reimport it into my localhost database once the edits are done and will it overwrite the previous import? Will that work, or do I need to do anything more?

    There could be some things in the content that might be fine to continue to reference the real site. Not sure.

    My wp-config and other PHP files appear to be fine.

    Do you instructions apply to me?


  39. @PJG, just drop all the tables in the local database (assuming you’ve not done any changes you want to keep), do the search / replace in the SQL file as directed in this post, then re-import.

    Once again, instructions are provided as-is. Always back everything up before you do anything, and if you’re stuck, try hiring someone :)

  40. P.J.G. avatar P.J.G.

    Steve, Thanks for your speedy response. I changed the pathnames, incremented the s: values by 3 (in my case), and imported the .sql file again. It worked perfectly! Thanks so much.

  41. P.J.G. avatar P.J.G.

    P.S. I am working with WordPress 3.2.1, so your instructions still apply, if anyone is curious.

  42. Steve, many thanks for your guide/tutorial. I built a site on an sub-domain and when I tried to move it to its own domain on the same server, ran into massive problems. You pointed me in the right direction – thank you.

    One extra step I had to take was to edit the database name in the original (backed up) copy of the sql database to match the database name created for the new domain.

    Prior to that the database import kept on being rejected because user B didn’t have permission to access database A. Once I figured out to simply rename database A as database B it worked a treat.

    Your guidance on string arrays was most helpful.

  43. Brian avatar Brian

    Hi Steve,

    I moved everything to the live server after I was building the site locally, and everything appeared to be ok but when I try to access the site on the frontend it redirects back to http://localhost:8888 and i cannot figure out why. Any suggestions. thanks

  44. bshort avatar bshort

    I have followed your instructions (very nicely done, BTW). My site comes up with all of the content and most of the theme/style attributes shown correctly. However, a few things are off (menu location mainly). The admin page looks fine. The theme customize page shows the page correctly. However, when I choose “visit site” from the dashboard, things are just off. The WP admin ribbon across the top of the page is missing the icons, but the menus are there. I know I must be missing an edit somewhere, but I’m at a loss at this point. My site URL does not point straight to the wordpress directory. It points to root and then wordpress is a subdirectory. Any suggestions? Thanks!

  45. bshort avatar bshort

    Update to my previous comment…it was a cache issue. I cleared everything, reopened the site, and all is well. Thank you for the instructions!

  46. Zoltan avatar Zoltan

    Many thanks for the CFORMS part, I almost gave up with the corrupted settings error!


  47. Jose Luis Nieto avatar Jose Luis Nieto

    Hi!, I just moved my site by changing the site’s urls in the settings, as recommended in wordpress codex. Everything works fine in the front end, but the dashboard inst working, i cant access in wp-admin, I just get a blank page. Is there any known fix?

  48. Steve Taylor avatar Steve Taylor

    Hi Jose, as you probably gathered from my above post – especially the opening! – moving a WordPress site can be quite complex. It’s hard to know exactly what’s gone wrong for you from your brief description. Also, please note that the above post is quite old. I’m sure there’s more up-to-date tutorials out there, and there’s bound to be a well-rated plugin to help you move.

Comments are closed.