Menu Search
Jump to the content X X
Smashing Conf New York

We use ad-blockers as well, you know. We gotta keep those servers running though. Did you know that we publish useful books and run friendly conferences — crafted for pros like yourself? E.g. upcoming SmashingConf New York, dedicated to smart front-end techniques and design patterns.

Moving A WordPress Website Without Hassle


Moving WordPress is a task that many people find daunting. The advice on the Codex, while comprehensive, gives you a myriad of options and doesn’t describe the process simply and in one place.

When I had to move a WordPress installation for the first time, I spent hours searching online for information on the various aspects of the process, and eventually wrote myself a checklist — which I still use.

So to save you the hassle, here’s a step-by-step guide to moving a WordPress website. I’ll cover three different scenarios, which in my experience are the most common:

  • Moving a website from a subdirectory of a domain to the root directory (for example, if you’ve been using a subdirectory for development while not affecting an existing website that’s in the root);
  • Moving a website from a local installation to a remote installation; and
  • Moving a website between domains or hosts.

Before You Start Link

Before you start any of these methods, make a backup of your website:

  • Your theme files;
  • Your uploads;
  • The plugins you’ve used, so you won’t have to spend time downloading them again if things go wrong; and
  • Your database.

You can back up the database using one of a number of tools:

  • phpMyAdmin1;
  • Sequel Pro2 for OS X;
  • Terminal commands;
  • A MySQL desktop client; or
  • A backup plugin such as WP-DB-Backup193, which will provide you a copy of your database by email or download.

In this article I’ll show you how to back up your database using phpMyAdmin, as this is provided by most hosting providers and has a relatively easy-to-use interface.

If I’m going to be editing the database (which needs to be done when uploading a website or moving it between hosts or servers), I start by making a duplicate of the database and adding “old” to its name. This is the backup, and I’ll be editing the original database.

Moving A Website From A Subdirectory To The Root Link

This is by far the simplest of the three moves I’m going to cover, because you don’t actually have to move anything — or nearly anything. This method will work on a standard installation of WordPress, and will work with most frameworks, or if you’re using a parent and child theme structure.

Beware! This method will not work for multisite installations, just for standard single-site installations.

The great thing about this method is that it only takes from three to ten minutes depending on your setup — no time at all in the scheme of things.

1. Remove the Existing Website Link

If there is an existing website in the root directory, remove it. It may be another WordPress installation or it may be a static website.

If it’s a WordPress website, make a backup as detailed above, and then delete all of the WordPress files in the root.

  • If you have access to Softaculous4 or another installation service via your hosting control panel, use that to uninstall WordPress.
  • If not, use phpMyAdmin to drop (delete) the database from the existing website. See the next section for details of how to do this.
  • After dropping the database, remove all WordPress files. This normally means any files or folders beginning with wp-.
  • Beware — don’t remove the existing site until you have made a backup!

Turn off pretty permalinks in the “Permalinks” screen, which you’ll find in the “Settings” menu. Do this by selecting the “Default” option and clicking “Save Changes.”

Permalink Settings screen.5
Larger version6.

3. Change Your Website Address Link

In “Settings” → “General,” change the address of your website but not the address of WordPress. For example if you’ve been working on the website at, change the settings as follows:

  • WordPress address (URL):
  • Site Address (URL):

Save by clicking on the “Save Changes” button and move on to the next steps before trying to access your website.

4. Copy and Edit Two Files Link

Using FTP/SFTP or cPanel file manager, copy (don’t move) the following files from your WordPress directory to the root directory:

  • index.php
  • .htaccess, if you have one. If there isn’t an .htaccess file (and turning off pretty permalinks means you’re less likely to have one), don’t worry about creating one.

Edit the index.php file that you’ve moved. You could do this by:

  • Editing it in situ after the move, by using FTP/SFTP or cPanel file manager;
  • Downloading it from the subdirectory, editing it and then uploading it to the root directory — instead of making a copy.

The edit you need to make is very simple, to one line at the end of the file. You simply change this:

require ('./wp-blog-header.php) this:

require ('./subdirectoryname/wp-blog-header.php)

So if you’ve been developing in, just change the line to:

require ('./development/wp-blog-header.php)

Save the new index.php file.

Back in the WordPress admin, turn pretty permalinks on again, with whatever setting you need for your website.

Visit the root domain of your website in the browser and it will display the website that’s stored in the subdirectory, but the URL will show the root URL rather than the subdirectory URL. And that’s it!

Uploading A WordPress Website From A Local To A Remote Installation Link

This is one of the most common instances of moving WordPress. If you’re working on a local website for development and need to upload it either to go live or because you need to show a client or other team members your work, you’re going to need to upload your WordPress website. This is more complicated than moving from a subdirectory to the root directory, and involves moving three things:

  • WordPress itself — you’ll need to install this in the new location;
  • The database — which you can move using phpMyAdmin;
  • Your theme files, uploads and plugins.

Turn off pretty permalinks in the “Permalinks” screen, which you’ll find in the “Settings” menu. Do this by selecting the “Default” option and clicking “Save Changes.”

2. Backup the Database Link

Make a copy of the database and give it a new name (for example, by adding “old” to its name).

3. Install WordPress In the New Location and Upload Content Link

Using your preferred method, install WordPress on the server you want to move your website to.

Using FTP or SFTP, copy the files from your local “wp-content” directory to the remote “wp-content” directory, using the same folder structure as in your local install.

Go and have a cup of coffee. These files could take a while to upload.

4. Edit the Database Link

Don’t just open the original database file from your local installation and edit it. DB ata stored serialized will break if edited directly in a text editor. You are better off with a serialize-aware tool like Search-Replace-DB7 (thanks, Andrey Savchenko!). Replace the old, local URL for the website with the new, remote URL.

So for example, if your local URL is http://localhost/example, you would change it to

Using the “replace” command will speed this up — there could be thousands of instances. Save your new database.

5. Drop the Existing Remote Database Link

Note: This step only applies if you’ve used a script such as Softaculous or Fantastico to install WordPress, as they automatically create a new database. If you’ve installed WordPress manually, you can ignore this bit.

In phpMyAdmin, drop (delete) the database that was installed in the remote website when you installed WordPress:

  • Select the database you’re working with.
  • Click on the “Structure” tab.
  • Below the list of tables, click “Check All.”
  • In the drop-down menu which says “With selected,” select “Drop”:Dropping a database in phpMyAdmin.8
    Larger version9.
  • You will see a warning message checking that you want to drop all tables. Click “Yes.”
  • Finally you will see a message telling you that your query has been implemented:Confirmation message after dropping a database.10
    Larger version11.

6. Upload the New Database Link

While you are still in phpMyAdmin, upload the database you’ve edited:

  • Click the “Import” tab.
  • Click the “Choose file” button.
  • Select the database you saved in step 4 and click “Choose” or “OK.”
  • Click the “Go” button.
  • After a while (depending on the size of your database), you will see a message telling you the upload has successfully finished:Confirmation message after importing a database.12

7. Clear Your Browser’s Cache Link

This avoids any problems you may have if the browser has cached content from the old version of the remote database.

Your log-in details will be the same as for your local website. If you specified different log-in details when installing remotely, these will have been overridden by the imported database.

Visit the “Permalinks” screen and turn pretty permalinks back on.

You’re done!

Moving A WordPress Website Between Hosts Link

This process is almost exactly the same as that for uploading a website from a local installation. The only difference is that you need to download the files and database from the existing website.

Follow the above process, with changes to step 2:

2. Download and Backup the Old Database and Files Link

In phpMyAdmin for the old website, select the correct database and click on the “Export” tab. Download the database by clicking the “Go” button. The database will download to your machine.

Move the database out of your downloads folder to somewhere useful and make a copy of it. You’ll be working with this database in Step 4.

Using FTP or SFTP, download the contents of wp-content from your old website. You will upload this to the new website in step 3.

Now return to the original process.

Summary Link

Moving WordPress doesn’t need to be complicated. As long as you follow the steps above in the right order, your data will be safe and your website will work in its new location. Important points to remember are:

  • Always back up your website before you start.
  • If moving WordPress within a domain, you don’t need to move the whole thing, just make some changes to the settings and move and edit the index.php file.
  • When uploading your database to a new location, make sure you upload the version that you’ve edited with the new URL, not the backup version with the old URL. Otherwise, at the very least, internal links will break and it’s possible you’ll see the white screen of death when you try to install your website.

If at any stage you go wrong, undo what you’ve done and start again with your backup. You did make a backup, right?

Resources Link

The WordPress Codex includes resources that will help you apply this method whatever your hosting setup:

For help with phpMyAdmin, see phpMyAdmin’s documentation16.

There are also plugins which will help you move WordPress if you don’t want to do it all manually. I haven’t tested all of these, so I can’t vouch for their reliability or ease of use. If you do use one, do so with care.


Footnotes Link

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
SmashingConf New York

Hold on, Tiger! Thank you for reading the article. Did you know that we also publish printed books and run friendly conferences – crafted for pros like you? Like SmashingConf New York, on June 14–15, with smart design patterns and front-end techniques.

↑ Back to top Tweet itShare on Facebook

Rachel is a freelance web designer and writer specialising in mobile and responsive WordPress development. She's the author of 'Mobile WordPress Development', a comprehensive guide to making yourWordPress site mobile-friendly, published by Packt, and also author of 'WordPress Pushing the Limits', published by Wiley.

  1. 1

    Carson Shold

    April 8, 2013 8:07 am

    Some pretty good tips, but have to acknowledge that doing a simple find and replace in the SQL file for the site URL can break settings (mainly widgets and some plugin meta data).

    I suggest using this script to safely swap out any serialized strings/arrays, and remove the chance of losing settings during the switch.

  2. 2

    A great summary but thought I would just point out one issue which I discovered recently.

    When you do a simple find and replace in the database for the domain name, if the domain is stored as serialised data anywhere, like post meta, it may corrupt the value.

    I found this article by Interconnect IT about this issue and a useful script they developed to find/replace in a safe way.

  3. 3

    Viktor Solovey

    April 8, 2013 8:23 am

    4. Edit the Database – it can kill serialize ( values in the wp_options or wp_postmeta table in DB. so, think twice. You do no need “replace” URL for ALL tables in the DB maybe only for wp_posts.

    Thank you

  4. 4

    That seems like a bit of a runaround… The Duplicator plugin does this much more easily.

    You just create a Zipped package on your dev server, upload the folder by FTP to the new location, give the plugin your database credentials, and boom – you’re done.

  5. 7

    Luke Stevenson

    April 8, 2013 8:38 am

    There is a (free) WordPress Plugin which automates all of this for you. Duplicator –
    I have used this a pile of times for moving WordPress installs between servers and domains. It seems pretty much bullet- (and idiot-) proof in my experience. And so much simpler!

  6. 8

    Excellent resource, thanks Rachel!

  7. 9

    Vitaly Friedman (editor-in-chief of Smashing Magazine)

    April 8, 2013 8:51 am

    Thanks to everyone for the feedback! The section on editing the database was updated! Sorry for any inconvenience caused.

  8. 10

    Thanks for your article. Just wanted to mention the wp-migrate-db Plugin (, which allows you to backup your DB, while change your URLs and absolute pathes.

  9. 11

    You missed BackupBuddy. I’ve moved loads of site seamlessly with it, I’d thoroughly recommend it. And no, I don’t work for them, honestly…

    • 12

      Jared Newnam

      July 1, 2014 3:14 pm

      I don’t think one should have to pay for a backup solution with WordPress. This should be a built in feature somewhere.

  10. 13

    anonymous berlinerin

    April 8, 2013 8:53 am

    Just in regard to editing the database, it’s possible to make a mess of things doing it that way, particularly with serialised data, e.g. if you’re using Advanced Custom fields and have stuff in repeater fields, or just having widgets and other things disappear and having to reset them.

    I’ve been using WordPress Serialized PHP Search Replace Tool for the past year and it’s deals with this very nicely.

    Also there can be occasionally be references to absolute paths in the database, so it’s good to change those also.

  11. 14

    Christopher McInerney

    April 9, 2013 1:00 am

    Great article, could of done with it about 2 weeks ago when I had a whole host of issues exporting and importing databases. Thanks!

  12. 15

    I use wordshell (from for this kind of operations. As wordshell is a command-line tool it is easy scriptable so you can fully automate the whole procedure, less change for errors or oversights.
    It btw also makes the management of wordpress plugins, themes, backups and what have you extremely easy. Not only for one site but in principle an indefinite number of local of remote sites. Not free but worth every penny.

  13. 16

    Phil Bonhard

    April 9, 2013 6:38 am


    I’ve used BackupBuddy for backing up and moving wordpress sites. While it isn’t cheap, I did a simple calculation.

    I can do a WP move with BackupBuddy in less than 15 mins compared to doing it manually which would take a couple of hours.

    In relation to what I’d charge per hour and number of times I’ve done a backup, backupbuddy works out waaaaaay cheaper in the long run.

    Btw, I’m not associated with the company at all, I’ve just used it a couple of times and found it really handy.

    Hope this helps,


    • 17

      Jason Mathes

      April 9, 2013 7:00 am

      I’ve found the most time it takes is actually pulling the data from the old host to the new one. The actual transfer/import and startup usually only takes me about 2 minutes on average?

      But if there is a tool out there that makes it easier then definitely use it :)

  14. 18

    Jason Mathes

    April 9, 2013 6:58 am

    I just performed a move that involved Genesis. Just copy/pasted the site essentially over to the new host. Imported the Database and *poof* it was ready to go. You do have to make sure you backup and restore the entire WP Content directory though to ensure that all of the settings are saved.

    One thing to note though – I did have a “fresh” install of WordPress on the new host.

    I did have to go into the database SQL backup file and change the user name to the person who was going to be using the site (same password).

    I would suggest that you temporarily change the WordPress admin password to something simple for the move then changing it after it has been successfully moved over to the new host.

  15. 19

    George Lerner

    April 9, 2013 8:24 pm

    I have used BackWPup successfully, to back up both the database and all files. Works for WP Multi-Site. Good error reporting, rare among plugins and essential for backup (for example, tells that it doesn’t follow a folder when it is a symlink, or if it retried to make the .zip file due to a timeout).

    I learned how to move a WordPress site into WordPress Multi-Site, with all the site, widget, user, comment, SEO, and page settings intact. It’s complex… but if you have a lot of pages with SEO, or other settings, it’s a lot easier than putting all those customizations back in by hand! I’ll probably never have a “step-by-step guide”, since it takes many MySQL queries and either meticulous text editing or good PHP programming to do it, so contact me at if you need that done.

  16. 20

    Great guide! I only wish I could have read it last week before I broke the record for fastest time to break a hosted WP installation. It can be a daunting task for a newbie like myself. It can’t be said enough: Back everything up! In the absence of certainty:security.

  17. 21

    Instead of doing all of this yourself, either use Duplicator or BackupBuddy (both will make your life a whole lot easier).

  18. 22

    I Agree with AC – far too much trouble. (and far too easy to make a mistake and stuff it up!)
    Seems to defeat the purpose of why we program!
    I use BackupBuddy as I move a lot of sites, but Duplicator works well too…

  19. 23

    Checkout this WordPress backup solution that backs up your site for free and you don’t have to set it up yourself. And optionally, you can pay a monthly fee to Update your WordPess core files and plugins, monitor your website for Uptime, get email reports with website traffic statistics, and update your website menus and content:

  20. 24

    If you have SSH access between your hosts you can also use rsync. I’ve been doing this recently between my local and final production. It’s much faster than waiting for sFTP to transfer everything.

  21. 25

    Ojassvi Chawla

    April 14, 2013 8:14 pm

    Thanks Rachel, I was looking for the same.

  22. 26

    Beware! This method will not work for: Sites using Genesis as a framework (or so I’m told, I haven’t tested it myself — if you can get it to work please leave a comment below).

    Genesis are no different to other themes when it comes to moving WordPress.

    WP Migrate DB plugin is free and does exactly the same thing as premium plugins like BackupBuddy.

  23. 27


    May 3, 2013 1:28 pm

    You guys definitely need to check Infinite WP. Backup & Cloning websites with 3 clicks, No Code, No SQL. Easy.

  24. 28

    Patrick Campbell

    May 28, 2013 10:28 pm

    You know what I like to do?

    Just move the folder and add this to wp-config.php:


    • 29

      Altering the WP_HOME and WP_SITEURL in the config file will work for the admin and navigation links, but the URLs for images, etc. will still point to the previous locations which remain in the database.

  25. 30

    I thought this was wonderful – at first. Easy as pie. Then I tried to see a draft of a post or page and I no longer have permission to preview drafts. I developed inside a folder and then followed the first set of instructions above (Moving A Website From A Subdirectory To The Root).

    Did anyone else have this problem and is there a fix?

    • 31

      Rachel McCollin

      June 7, 2013 1:42 am

      Thanks for all the comments – I agree that there are plugins etc. that do this but some of them cost money and a lot of people like to be able to do things manually, oir at least understand what’s going on if they don’t actually do it themselves.

      Personally I’ve done this hundreds of times and never had any problems but thanks for the tips from those of you who have and for your suggestions too.


      • 32

        Hi Rachel,
        I am a new user to WordPress and have gone through many tormenting hours on this subject. I have a direct connection to an ftp server where I have a wordpress site I was developing within a current live website. So the url to the new WP site has /wordpress at the end. Wouldn’t I be able to just take that entire WP folder and copy it to my hard drive as a backup? Or would I still have to go through everything in your tutorial? Because every file is in that WordPress folder.

        thank you
        Marilyn Glisci

    • 33

      Rachel McCollin

      June 7, 2013 1:39 am

      Hi Cindy,

      I’m puzzled by this as moving from a subdirectory to the root shouldn’t affect your drafts or permissions at all. I can only guess it’s something to do with your hosting setup and/or your read/write permissions. You may want to speak to your hosting provider and check your .htaccess file. It’s also worth refreshing your Permalinks settings by visiting the Permalinks screen and saving your settings (you don’t have to change anything). Sometimes that works.

      I hope that helps!

  26. 34

    Thank you thank you thank you for posting this!!!!!

    I was struggling with this and thought, someone has to have done this before. I am so grateful to have been able to learn quickly through your experience.

  27. 35

    Thanks for the tutorial, just wanted to add that you can zip the folders and upload/extract them through cpanel. : )

  28. 36

    Rachel McCollin

    July 22, 2013 1:04 am

    Thanks to everyone who pointed out my error about whether this works with Genesis – as the article originally said, this was based on something I was told by a Genesis user and not based on my own testing. I’ve now completely removed that line – this method WILL work with Genesis.

  29. 37

    Glenn Ferrell

    July 22, 2013 7:52 am

    Great post Rachel! Much clearer than the Codex. One thing I noticed in the Codex under the “Moving to a New Server” heading, is that they don’t mention turning off Permalinks (although they do for the other categories earlier.) Is this step specifically targeted at getting your new .htaccess right or are there other things that could go south if you don’t do this?

  30. 38

    Alex St Clair

    August 6, 2013 1:42 pm

    Thanks, Rachel – for taking the trouble to make this so very clear and explicit. I wasted a whole day trying to replace my old HTML site with my new WordPress one. I got myself into a real mess! But your post had me out of trouble in no time. I just went back to backups and started again from scratch as you describe. Brilliant! All done in an hour.
    Thank you.

  31. 39

    Awesome. Thank you so much.

  32. 40

    I want to move my blog without actually moving anything. Let me explain:
    Currently the WP site is at: and I want the address to be at the root i.e. However, I thought the easiest way of doing this would be to change the folder mapping i.e. from “” to “”. So, the URL would change (to lose the /blog/ suffix) but I’m not physically moving anything.

    Is it just a case of changing the site URL within “Settings” → “General,” and then changing the server folder mapping?

  33. 41

    Kristi Nelson

    August 24, 2013 6:30 pm

    I followed the instructions for moving my wordpress site to the root directory. Now, the home page will not load when I set the permalinks to Post Name. All of the other pages load fine.

    The home page will load if I change the permalinks setting to Default.

    I tried changing the permalinks back to Default and deleting the htacces file and changing permalinks back to Post Name, it didn’t help.

    Any suggestions? The website is:

    Thank you,


  34. 42

    Anonymous From Finland

    August 29, 2013 8:35 am

    WordPress Move worked for me! I moved my WP site from to and I used UpDraftPlus for the backup -> restore to move the site, and after that WordPress Move did the magic for me. Thanks!

  35. 43

    I’m going to be moving a WordPress website to a new host, but the new host already has a static HTML website in place. I’ve moved sites to new hosts just by installing a new WP installation in the new host, and restoring my backup files/database. I’m not sure of what steps I need to take to move the WP site to a host that currently has a static HTML site already hosted there. (And I need to change domain names, if that matters) Any help/advice would be appreciated.

  36. 44

    Sakunne Svensson

    September 15, 2013 10:12 pm

    It’s great article but I accomplished the same task in more straitforward way(basically the same):
    – 1. Download all files
    – 2. Make a SQL copy of the database
    – 3. Put all this into same folder
    – 4. Replace: http://old-web-address –>> http://new-web address (I used DW and 1800+ replacements was made)
    – 5. Make new database & edit wp-config.php for this
    – 6. Upoad files into new location
    – 7. Import SQL into new database
    … voila (you don’t need to make old site backup, because it left untouched)

  37. 45

    I want to just say that if you want to move a wordpress site Duplicator is THE plugin to have. Its remarkably simple and easy to use and install. You don’t even have to worry about your urls.

    I moved a WooCommerce site from my localhost to the web and it did it seamlessly. I mean, it moved the products, product categories, Theme settings. EVERYTHING!!! I didn’t need to backup anything. My local site is still working as is and now I have a clone of it online. :)

  38. 46

    Thanks for the update vis-a-vis Genesis!

    I do use, Backup Buddy. It is the best. But I love learning all the step by step ways of doing it manually.

    Believe it or not, sometimes, Backup Buddy will NOT backup a site. Maybe the client’s site is screwed up. Maybe that’s why you need to move the site in the first place. So please don’t think BackupBuddy is going to save your rear end in every instance, cause it won’t. Life ain’t always that easy!

    Just sayin’ !

    p.s. but having said that, please know that I DO love BackupBuddy

  39. 47

    Thank you for this!
    I migrated my site(from a regular html site to wp) using the “Moving A Website From A Subdirectory To The Root” route. Evreything worked for all the pages but the problem I’m having is the images and pdfs i have on the site still show the…/image-name.jpg. Is there anyway to fix this? Thanks you!

  40. 48

    as they automatically create a new database. If you’ve installed WordPress manually, you can ignore this bit.


↑ Back to top