Moving A WordPress Website Without Hassle

Advertisement

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

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

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

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!

2. Turn Off Permalinks

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

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 example.com/development, change the settings as follows:

  • WordPress address (URL): http://example.com/development
  • Site Address (URL): http://example.com

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

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)

..to this:

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

So if you’ve been developing in example.com/development, just change the line to:

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

Save the new index.php file.

5. Turn Permalinks Back On and Test

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

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.

1. Turn Off Permalinks

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

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

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

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 http://example.com.

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

5. Drop the Existing Remote Database

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

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

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

8. Log Into the WordPress Admin For the Remote Website and Update Permalinks

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

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

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

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

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.

(cp)

Footnotes

  1. 1 http://www.phpmyadmin.net/home_page/index.php
  2. 2 http://www.sequelpro.com
  3. 3 http://wordpress.org/extend/plugins/wp-db-backup/
  4. 4 http://www.softaculous.com/
  5. 5 http://www.smashingmagazine.com/wp-content/uploads/2013/01/1-permalinks.png
  6. 6 http://www.smashingmagazine.com/wp-content/uploads/2013/01/1-permalinks.png
  7. 7 https://github.com/interconnectit/Search-Replace-DB
  8. 8 http://www.smashingmagazine.com/wp-content/uploads/2013/01/2-phpmyadmin-drop-tables.jpg
  9. 9 http://www.smashingmagazine.com/wp-content/uploads/2013/01/2-phpmyadmin-drop-tables.jpg
  10. 10 http://www.smashingmagazine.com/wp-content/uploads/2013/04/3-phpmyadmin-drop-success.png
  11. 11 http://www.smashingmagazine.com/wp-content/uploads/2013/04/3-phpmyadmin-drop-success.png
  12. 12 http://www.smashingmagazine.com/wp-content/uploads/2012/12/4-phpmyadmin-import-success.jpg
  13. 13 http://codex.wordpress.org/Moving_WordPress
  14. 14 http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
  15. 15 http://codex.wordpress.org/Installing_WordPress
  16. 16 http://www.phpmyadmin.net/documentation/
  17. 17 http://wordpress.org/extend/plugins/wordpress-move/
  18. 18 http://wordpress.org/extend/plugins/backup-and-move/
  19. 19 http://wordpress.org/extend/plugins/wp-db-backup/

↑ Back to topShare on Twitter

Advertising
  1. 1

    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.

    https://gist.github.com/jcanfield/2240003

    2
  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. 3

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

    http://wordpress.org/extend/plugins/duplicator/

    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.

    6
  4. 6

    Thanks for your article. Just wanted to mention the wp-migrate-db Plugin (http://wordpress.org/extend/plugins/wp-migrate-db/), which allows you to backup your DB, while change your URLs and absolute pathes.

    3
  5. 7

    4. Edit the Database – it can kill serialize (http://php.net/manual/ru/function.serialize.php) 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

    1
  6. 8

    There is a (free) WordPress Plugin which automates all of this for you. Duplicator – https://wordpress.org/extend/plugins/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!

    3
  7. 9

    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…

    5
    • 10

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

      0
  8. 11

    Excellent resource, thanks Rachel!

    0
  9. 12

    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.

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

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

    0
  12. 15

    I use wordshell (from wordshell.net) 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.

    0
  13. 16

    Hi,

    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,

    Phil

    0
    • 17

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

      0
  14. 18

    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.

    0
  15. 19

    Great guide! I only wish I could have read it last week before I broke the record for fastest time to break a page.ly 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.

    0
  16. 20

    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 http://glerner.com/contact.php if you need that done.

    0
  17. 21

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

    0
  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…
    Dave

    0
  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: http://www.wp-monitor.com/

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

    0
  21. 25

    Thanks Rachel, I was looking for the same.

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

    0
  23. 27

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

    0
  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:

    define(‘WP_HOME’,’http://newurl.com’);
    define(‘WP_SITEURL’,’http://newurl.com’);

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

      0
  25. 30

    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.

    0
  26. 31

    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?

    0
    • 32

      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!
      Rachel.

      0
    • 33

      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.

      Rachel.

      0
      • 34

        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.

        HELP!!
        thank you
        Marilyn Glisci

        0
  27. 35

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

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

    0
  29. 37

    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?

    0
  30. 38

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

    0
  31. 39

    Awesome. Thank you so much.

    0
  32. 40

    I want to move my blog without actually moving anything. Let me explain:
    Currently the WP site is at: url.com/blog and I want the address to be at the root i.e. url.com. However, I thought the easiest way of doing this would be to change the folder mapping i.e. from “host.com/serverdir/accountdir/html_public/url.com” to “host.com/serverdir/accountdir/html_public/url.com/blog”. 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?

    0
  33. 41

    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: krististickysigns.com

    Thank you,

    Kristi

    1
  34. 42

    Anonymous From Finland

    August 29, 2013 8:35 am

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

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

    0
  36. 44

    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)

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

    0
  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

    0
  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 domain.com/dev-site/…/image-name.jpg. Is there anyway to fix this? Thanks you!

    0
  40. 48

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

    0
  41. 49

    Hi, Thanks for the step-by-step.

    Sorry if I’m being dense but I can’t figure out step four.

    Exactly where do you do the search and replace? In these instructions I am to do it on the desktop copy I downloaded and duplicated, but I am not to open in text editor. I am to use one of the plugins, but a plugin loaded at the destination host can’t search the SQL copy on my desktop, so I don’t get it.

    If I load it on the old hosting site, well, I already downloaded SQL, so that won’t work; so it’s the old host or the destination host but how does that help when I am supposed to replace the URLs before loading the database.

    Do you see what I mean?

    I’m probably missing something obvious.

    Thank you so much for further elucidation & patience. I appreciate it. This is my first move.

    0
  42. 51

    this was super super helpful, thanks for writing this up.

    all the steps worked for me

    0
  43. 52

    Thank you so much for this – saved me SO much time and hassle and a lot clearer than the Codex.

    0
  44. 53

    Thank you :-)

    Clear article and helpful
    Work perfectly, you saved me much time.

    0
  45. 54

    Ah, you absolute beauty. Am new to WordPress, so more than a touch nervous about moving the site. Followed your instructions for “Moving A Website From A Subdirectory To The Root”, for a Genesis site (using “Lisa Marie” theme), only took a few minutes, and worked perfectly, just as you described. PHEW! Massive thanks! Hugely grateful. I now owe you beer or something. :)

    0
  46. 55

    Thanks for the Info.

    What if the new database(test site) has different prefix? ($table_prefix) should I just replace the prefix in the config.php(live site) to match the prefix in the database? wouldn’t it cause any problem?

    0
  47. 56

    Thanks, this helped me move a Jigoshop wordpress install to a new host. I kept the domain name but had to transfer to a temporary IP address initially – then back to the initial domain name when nameservers had been updated.

    I ran into trouble in 2 areas: the table prefix changed (I was anticipating this and corrected the new prefixes to the old ones – but the old ones had somehow changed from upper to lowercase and this caused some hassle). The other thing was changing the urls through the search script as, for some reason, I needed to do this twice to catch some URLs that had a slight difference.

    Oh and I couldn’t log in after it all seemed to work, but I needed to modify the table prefixes in the usermeta table to match the lowercase issue mentioned above.

    But feels good to get there and now I’m much more confident of doing this in the future.

    PS. I wanted to use the Duplicator plugin but it wouldn’t work with the constrictions of my host (this is the reason we are moving in the first place – incompatible plugins).

    0
  48. 57

    I have the same question as kkrousseau:

    I’ve downloaded the database to my desktop, along with the content files.

    I’ve uploaded the contents of the content file to the new server which has WP already installed. (Thus, can’t use Duplicator Plugin)

    I’ve uploaded the search replace DB php script into the root folder in on the new server.

    In running the script, how do I edit and save the database file on my desktop? (Step No. 4)

    Then, once edited, how and where do I upload the edited database file? )Step No. 6)

    This piece of information is missing from the instructions, and as a newcomer to this process, it’s a crucial one, since I’m at a standstill in getting this site migrated.

    Thanks.

    0
  49. 60

    Absolutely rock solid instructions!!! I am in the IT field but am not a webdesigner by no means.

    I was able to help my client out of a bad relationship with their designer/host who gave them 24hrs to find a new host. This applied to two websites, had them back up and running in 48 hours!

    Great work and thanks for the instructions!!

    0
  50. 61

    since a had the same uncertainty as alvalyn & kkrousseau, i´ve decided to change a little but the order of the tasks to see what happens…
    1. Upload wp_content to destiny
    2. Drop (automatically created) DB in destiny
    3. import DB original trough PHPMyAdmin
    4. Edit imported DB using SEARCH-REPLACE-DB
    5. Hope everything went ok…(and clean cache)

    I´ll let you know the result, since I have a 1.2 GB wp_config file it´s going to take a while…

    0
  51. 63

    how can i migrate my wordpress site to drupal. I googled a lot and found that wordpress migration tool can be used. But I didn’ get any information about its installation process and how to use it to complete migration process. Please help me.

    Thanks a lot :)

    0
  52. 64

    I did exactly as the tutorial instructs as none of the plugins worked for me. I have the core of the site moved over, the data and product galleries (thank goodness!), however the Sidebars, Menus, and Widgets setup within the theme did not come over (and I did copy EVERYTHING under wp_content over). Any suggestions of where this is stored or how to get it moved over? The customization was extensive. We are using the Room09 Theme and we did create a child theme which was customized. Thanks!

    0
  53. 65

    Hi Rachel, hi all,
    happy to find this helpfull page and advices after some serious research.
    My case is moving my wordpress blog/installation from a subdirectory to the main directory of my website (“subdomain.homepage.de” to “www.homepage.de”). I managed to let the startpage of the domain point to the subdirectory. So far so good. But all following pages of course show the subdomain URL. And I wonder, if leaving it that way, it is not the best as it comes to SEO. And it looks a little bit weird also.
    Would be great if you have some ideas about this.
    Cheers,
    Frank

    0
  54. 66

    I believe that finding the url and replacing is not a good idea. I have used the plugin instead to do this. Duplicator is great plugin for migration.
    Detail here http://www.wpcares.com/migrating-wordpress-site-easily/
    This was quite easy to use. May be other can find it helpful

    0
  55. 67

    Hi Rachel,
    Great blog, especially moving to a new WordPress article. Actually, I’m working on my church site, and it became badly corrupted since the server PHP was upgraded. I can’t get into the WP-ADMIN, and it’s bad. No idea what should be done. Can you like give me an advise on what may have gone wrong please?

    Fatal error: Call to undefined function wp_is_mobile() in /home/jacqueli/public_html/wp-login.php on line 39

    Your help is very much appreciated. I have no idea about WordPress actually. Learning it right now.

    0
  56. 68

    Thanks, Rachel! This was a huge help — you made what I thought was going to be a complex challenge turn out to be really simple.

    0
  57. 69

    thanks for the great walkthrough.

    Just thought I’d mention that I’m about to launch my new service at migrately.com which will help those folks who don’t want to move the site themselves.

    The service will focus purely on moving WordPress websites from one host to another. Nothing more or less than that. It will also be priced competitively!

    Launching soon, but there is a sign-up page at the above address where folks can register for more information.

    Thanks again for the post!

    0
  58. 70

    Nice detailed explanation, But I have a suggestion,the dropping of exiting database can cause problems. A server can host many WordPress sites and databases. Instead; creation of new database on existing server is advisable. Some readers who are running multiple databases can delete an irrelevant database. I have done the same mistake for my site http://www.techrecite.com which had to pull down due to such error. Thought of sharing my experience.

    0
  59. 71

    Followed this tutorial and all is well. Just not sure about putting a 301 redirect in from the old site so as not to lose traffic etc.
    Will I get Google slap for this?
    How long do I need to leave the 301 in before I can reuse the old site for something else?
    What is the correct 301 syntax for .htaccess file?

    Thanks, in anticipation.
    Mike

    0
  60. 72

    I just did the first option, “Moving A Website From A Subdirectory To The Root.” and the site pulled up fine. But when I went back in to change the Permalinks back to “Post Name”, none of the pages (except for the home page) would pull up. If I leave Permalinks at “Default” all the pages pull up fine.

    Any ideas?

    The site in question is http://www.regenerationfitnessar.com

    Thanks!
    -Kevin

    0
  61. 73

    You helped me a lot, I can finally go to sleep. Thanks!

    0
  62. 74

    Hi there!
    I’ve read two other articles on moving a website from subdirectory to the root.

    One from wordpress codex – http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre-existing_subdirectory_install

    And one from askwpgirl – http://askwpgirl.com/how-do-i-move-wordpress-from-a-subdirectory-to-the-root-directory/

    In these other articles, there is no mention about having to turn pretty permalinks off before you make the URL site address change. In your article it says you should do so.

    Can you shed some light on why you would or would not want to turn off pretty permalinks before you make the URL update?

    Thanks!

    1
  63. 75

    Hi – I just migrated the new site as instructed here and it worked. But I have two problems. First, when I click on “home” from anywhere else on the new website, it still goes to “hillhouseoperacompany.org/wordpress/” rather than just “hillhouseoperacompany.org” and Second, when I turn permalinks on, the home page link no longer works – it takes me to a page that says page not found.

    0
    • 76

      I have the same problem as Harmony on lushlives.co.uk, if I click home from anywhere else in the site I get error 404!

      I would really appreciate help on this one, Kevin (from coolpenguin.co.uk – new site coming soon).

      0
    • 78

      Yes, this is a problem. When you load the root, it goes directly to the sub directory listed as your wordpress site and shows up on the URL as /subsite. All others work well. Anyone found a solution to this?

      1
  64. 80

    Brett Stevenson

    April 15, 2014 1:26 pm

    Easy, just what I was after. Thanks for the article.

    0
  65. 81

    Great article, Rachel, thanks! This is my first visit to smashingmagazine, but will not be my last.

    I am one who also wants to sing the praises of the plugin, Duplicator. I’ve used it many times now, working on my first websites, creating back up clones for testing purposes. I am commenting to add this note for those who have run into issues where they could not use Duplicator because of some issue with their hosting company. My own had a time-out issue that blocked my use of Duplicator.

    This issue was solved — thanks to the help of this wonderful plugin’s author — by uploading the package to the new site, then manually extracting the Archive/Package from within the directory via cPanel>File Manager. (Check the plugin support pages for detailed instructions.) Completely bypassed the hosting company’s limitations and worked like a charm.

    0
  66. 82

    Anders Holm-Jensen

    May 11, 2014 12:01 pm

    Thank you so much! Simple and easy! :)

    0
  67. 83

    I thought I had all the steps down, but your post was very helpful indeed. Worked flawlessly! Thank you!

    0
  68. 84

    David @ HostAwesome

    May 18, 2014 6:31 am

    Awesomely in-depth! Also, keep in mind that a good number of WP hosts these days move your site free of charge to save you the hassle.

    0
  69. 85

    Christian Kallen

    May 30, 2014 9:32 pm

    Okay, most of this worked fine, I can navigate the site with the Menu bar and all works well – except the home page. You mention the .htaccess file, but didn’t outline any changes here. When I load the default URL (without the subdirectory) I get an error message; if I go to a cached page deeper in the site I can see all the pages, except “HOME” I get the error message (too many redirects, which sounds like an htaccess error.)

    Using the Appearance/Menu does not allow a specific URL change, as outlined above. So, what should we do with this .htaccess file???

    1
  70. 86

    Thank you Rachel so much – worked like a dream!

    0
  71. 87

    Hi,

    This a very useful article/tutorial, but I guess that there are other alternatives to the “manual” migration process.

    I’ve seen several plugins like Duplicator that can help you migrate from server to server.

    I’ve also developed another plugin for this, it’s a complete solution:

    http://codecanyon.net/item/wp-golive/7793291?ref=RedhopIT

    GoLive plugin has a lot of features:

    Automatically Export the Database from Source Server
    Transfering the files via FTP automatically
    Auto-import Database in Remote/destination server.
    Update .Htaccess properly
    Update wp-config.php file on destination server with the new credentials.
    Replace the URLs in Database (Posts, Pages, Menus…), and keep auto-update serialized objects too.

    I hope it helps someone.

    Regards,

    0
  72. 88

    Hi Rachel/all! I just used your instructions and got to Step 5 of Moving A Website From A Subdirectory To The Root. I cannot complete Step 5 because I cannot access my WP login. For whatever reason, I’m getting 404 errors and cannot get into the dashboard. Luckily, my site moved perfectly but now I’m stuck out of editing it. I’m talking with my Hosting Help now. Any tips or thoughts? Thank you!

    0
  73. 89

    Update: Hosting fixed the issue; however, whenever I click on a link from my page, the word “testsite” displays in the URL. Is there a way to take that out?

    0
  74. 90

    I’m in the throws of moving my website now and I wanted to thank you for the GENIUS tip of turning off permalinks. I didn’t understand the significance of this until I tried to browse my site on the new server (without the domain name).

    Using your genius tip I was able to confirm that my site is working in both old and new locations.

    I read several tutorials and none of them suggested this.

    Thank you!

    L

    0
  75. 91

    Spencer Goldade

    July 7, 2014 3:27 am

    A few styles and things like that broke, but that was due to my sloppy coding in the past, which I will remedy now. Thanks so much for this helpful post!

    1
  76. 92

    Thank u so much! This post is a life-saver.

    0
  77. 93

    Most people wouldn’t think of it, but I used my backup plugin – UpdraftPlus – to migrate my site and it worked seamlessly, from start to finish. I didn’t need to use any other plugin or do anything else. Don’t want to push it but I really love this plugin and the support is amazing! https://updraftplus.com

    -1
  78. 94

    Awesome tutorial. Thanks to you, I only took me a couple of hours to do everything and get smarterparis.com on my new dev server running. Brilliant!

    1
  79. 95

    Thank you for a “bullet-proof” tutorial. Just changed hosting providers and needed to move a WP site pronto. Followed your instructions and voila .. everything moved perfectly. No runs, no drips, no errors!!

    1
  80. 96

    Followed the instruction for moving a WordPress website from a sub-directory – worked like a charm! Many thanks for your clear advice. Very pleased with our new site grid24.co.uk

    0
  81. 97

    Whomever wrote this article is a freaking idiot and knows nothing about WordPress or programming; stop spewing bullshit.

    -1
  82. 98

    Hi,

    If the index file directs the user to the subdirectory installed wordpress, why do you need to even remove the one at the root/public directory?

    0
  83. 99

    Excellent article, thank you !

    0
  84. 100

    You should have called this “Jumping through hoops for a poorly written program!”, that would have covered it better… : )~

    0
  85. 101

    Thank you so much! This ended up being much easier than I’d anticipated. I followed your instructions for moving the new site out of a development subdirectory to the root. Perfect.

    0
    • 102

      As a follow-up… everything moved nicely but now I can’t get WordPress to write to the server for plug-ins, media library, etc. It WILL update a page or post, but it can’t write to the uploads folder. I’ve tried changing permissions but to no avail. I can upload directly to the server to update plugins, but when I upload images manually they don’t even show in the media library.

      Anybody experienced this or have ideas? I would appreciate any suggestions as I’ve been trying all kinds of advice found in searches for 2 days now. I have GOT to get this solved…

      0
  86. 103

    Stefaan Van Eenoo

    November 19, 2014 5:11 pm

    Great article! Thank you so much for sharing.
    I will use this in a couple of weeks.

    Kind regards
    Stefaan

    0

Leave a Comment

Yay! You've decided to leave a comment. That's fantastic! Please keep in mind that comments are moderated and rel="nofollow" is in use. So, please do not use a spammy keyword or a domain as your name, or else it will be deleted. Let's have a personal and meaningful conversation instead. Thanks for dropping by!

↑ Back to top