Skip to main content
WordPress made easy with the drag & drop Total WordPress Theme!Learn More

How To Move Your WordPress Website From localhost To Live Server

Last updated on:
How To Move Your WordPress Website From localhost To Live Server

A virtual web server installed on your computer (or local server) allows you to build and customize a WordPress website with ease and speed. Since every edit requires saving and refreshing, developing a WordPress site on a live server can easily turn into a nightmare given the limitations of bandwidth and Internet traffic.

For this reason, most developers rightly choose to do all the nitty-gritty of WordPress development on a local server and later upload the finished website to the live server. Similarly, future updates to the website are done and tested locally before being uploaded to the live environment.

In this post, I’ll be going through the process of moving a WordPress website from a local server to a live server. This process allows you to safely move all of your site’s content (images, posts, and pages) as well as themes and plugins from a directory on your computer to your host’s production server. Obviously, there are a couple of handy plugins that can make this process a breeze, but it’s always advantageous to learn the manual process.

Prerequisites

In this tutorial, I’ll assume that you already have met a few prerequisites. These are just a few simple requirements that you’ll need before you can get started.

1. Local WordPress Installation

You should have a WordPress website running on your computer. To learn more about setting up your own localhost environment checkout our guides on how to install WordPress locally, or checkout Local by Flywheel.

2. Hosting Plan

You’ll also need an active hosting plan that offers PHP and MySQL support. Fortunately, most hosting providers support PHP and MySQL. Better yet, many providers offer one-click install scripts for WordPress so you don’t have to go through the manual setup.

We of course recommend WP Engine managed WordPress hosting – it’s how we power all of our websites and live theme demos. Plus, WP Engine makes managing your sites easy thanks to their intuitive admin panel. Plans start at $29 per month for one installation (but you can get 2 months free on annual plans when you use our link). If you’re not ready for that price tag, you can find a great starter shared hosting plan for around $3 per month from companies such as Bluehost or SiteGround.

3. SFTP Access

And finally, you should have SFTP access to your hosting account along with a client program such as FileZilla. You’ll be using it to upload the files to your host. Alternatively, you can use the File Manager option in cPanel but unlike SFTP, cPanel doesn’t provide a view of your local directory structure. Okay, with all of that in place, we should be ready to go.

Method 1: Export & Import Content Using Core WordPress Features

A quick and easy way to move a WordPress site from local server to a production environment is by using the built-in export tool in WordPress. This method assumes that WordPress is already installed and setup on your live hosting account and that there is no content on your live website. This is very important as the WordPress import feature will not override existing content, it will simply add to it. If you do have old content you can always use our guide to reset your WordPress website so you have a clean installation to work with.

Okay – to get started moving your website go to your locally installed WordPress dashboard and scroll down to Tools. Select Export and check the “All content” radial button.

WordPress Download Export File

This will download an XML file to your computer. The file will contain all the details about your site’s content (unless you selected a singular content download option, such as only your posts, pages, a custom post type or your media).

Now login to your live WordPress site, then activate the theme and plugins you used on the local server. Once that’s done navigate to Tools > Import.

WordPress Import LocalHost Content

If you’re prompted to install the WordPress import plugin, do so and then activate it. Finally, use the plugin to import the .xml file you exported from your localhost. To do this first click on the Run Importer options under the WordPress heading (Note: you can also use the importer feature to move content from other sources such as Blogger, Tumblr, etc).

WordPress Select XML File to Import

Next use the Choose File option to select your XML file then click to upload and import. Now just wait for your content to import. How long you wait will depend on how much content you import and your hosting plan.

This method will move your posts, pages, media and menus to your live site. You will of course have to set your menu locations and re-add your widgets, but considering that everything else is moved over for you, this is a great option if you don’t want to install any extra plugins or process the move manually.

Method 2: Use a Plugin to Move Your WordPress Website

If you want a seamless transfer of your website it might be best to consider a plugin. A quick Google search will turn up tons o free and premium options, but here are our three favorites (plus a quick explanation on how to use them to migrate your website).

Local

LocalWP

Local is a free software your can use to install WordPress locally on your computer. It makes it easy to setup a local host, duplicate test sites, create a local multi-site, archive sites and more. But one of the best features of Local is that you can easily migrate your local site to your live server with their “Local Connect” integration for Flywheel and WP Engine.

Duplicator

Duplicator Free WordPress Plugin

Duplicator is an awesome freemium plugin your can utilize to manage your own site backups and migrations (and one of the most popular options). With the Duplicator free plugin your can easily create your own on demand backups, design site bundles (a package of content, theme and plugins to reuse on client sites) and easily move your website from local to live (just install the plugin locally to package it, then install on your live site using the same plugin).

Alternatively, if you spring for Duplicator Pro you can utilize premium features for scheduled backups, synced storage (Amazon, Dropbox, Google Drive etc), multisite compatibility, cPanel API, email notification, pro support and more. One year costs less than a pair of Nike trainers, and knowing your website is safe and secure is more than worth it.

Solid Backups

Another fantastic solution is Solid Backups (formerly BackupBuddy). This lovely plugin is the premier solution to manage your own website backups. With it you can create full website backups (databases and all), schedule regular backups, store your own copies (locally or via Stash) and even restore your website with ImportBuddy.

But did you know that you can also utilize Solid Backups to move your local site to your live one? You can use the built-in migration features to move your website from computer to internet (or from host to host). The plugin handles domain changes, automatically replaces your URLs and more all to seamlessly transition your website for your big debut.

Transferito

Transferito Plugin

Lastly, another solid free option is Transferito. This easy site transfer plugin supports server-to-server as well as local-to-server (and visa versa) transfers. So whether you want to move a copy of your site offline for testing, or move design changes back to your live site you can.

Method 3: Manually Transfer Files From Local to Live Server

Your last option is to manually move your website files. This will require server access. Essentially, the process entails downloading the database file from the local installation, editing it for the correct paths before importing it to a new database on the server, and finally uploading all contents of the local WordPress installation.

Export Your Database File

To start, fire up your local server and navigate to phpMyAdmin – just type localhost/phpmyadmin into your web browser. In this example I’m using XAMPP and here is what my phpMyAdmin interface looks like:

phpMyAdmin

The panel on the left is where all databases are listed. Select the database for your local WordPress site and click on Export at the top of the phpMyAdmin window. The “Quick” export method is selected by default. Leave it intact and click Go.

Export database tables

A SQL file (such as my_test.sql) will be exported to the downloads folder on your computer.

Modify File Paths

When you build your WordPress website locally from the ground up, keep in mind that all your URLs will be absolute paths. In other words, all links to your content files (posts, images, post types) will start with https://localhost/. You have to modify this link structure for your live installation or your content will not display properly after uploading the database file.

To do that, use a code editor to perform a “find and replace” on the database file you just exported. I’m using Notepad++ to search and replace for “https://localhost/my_test” and replace it with my live URL. I simply created a “my_test” folder at the root folder for my domain. If you are going to install directly at the root, you don’t need to create any folder, so your replacement URL should simply be https://www.yourdomainname.com. You will be uploading your local WordPress folders to public_html (the root of your hosting account).

Modify file paths

Once you’re done replacing the URLs, save and close.

Create New Database on Your Hosting Account

Now you’re done with the main part on the local server. It’s time to setup the live environment and finally get the files uploaded so that your website can go live. How you setup a new database for your WordPress site will depend on your hosting.,

If your plan uses cPanel (like Bluehost or HostGator) open it up from your hosting account and browse to MySQL Databases.

Create new database

When you select MySQL Databases, you will be prompted to enter a username and password. This is the new user account that will be associated with the new database for your website. Note the personal details like your username and password because you’ll need them when configuring the database file in WordPress. The newly created database will have the same name as the username you chose.

If you’re using a managed hosting account you may not have cPanel. For example, with WP Engine you can create a new installation on your plan simply by logging into your account and clicking the Add Install link.

WP Engine Add Install

Next fill out the required information (which by the way, you can set this up as a staging site if you don’t have a domain ready just yet).

WP Engine Add Install Information

That’s it! Your new site (and database) is ready.

Upload Database File into New Database

Now that you have a new (empty) database on the live server, it’s time to upload your database file saved on your computer. Browse to the phpMyAdmin interface of your host and select Import. Browse and choose the SQL database file you exported from your website on the local server.

If your host doesn’t have phpMyAdmin, use the Database Restore option in MySQL Databases. It does the same thing—allows you to browse and select a SQL file.

mySQL database

I used the restore option to import my database file. Remember, this is a crucial step because it allows you to restore your website exactly as it was on the local installation. Now all that is left is to edit the wp-config.php file, upload website files, and fix the permalinks and we’ll be up and running.

Fix wp-config.php File

Open the wp-config.php file in your code editor (browse to your local WordPress installation folder). Here are the only details you need to change:

  • define(‘DB_NAME’, ‘your_database_name’);
  • define(‘DB_USER’, ‘your_database_user’);
  • define(‘DB_PASSWORD’, ‘your_database_password’);
  • define(‘DB_HOST’, ‘localhost’);

Just fill in the settings you defined while creating the database on your live server in Step 3. For the host name, fill in the server IP address or leave it as localhost if your host explicitly says so. I’ll leave mine as localhost as it’s clearly stated here: “To connect to this database in a script running on your web server you should use “localhost” as the hostname.” When you’re done editing the settings, save and close the file. Don’t change anything else.

Note: Make sure to save a copy of your old values, just in case anything goes wrong you can always revert back.

Uploading Website Files

It’s now time to move the actual WordPress website files as we’ve setup everything on the live server. Fire up your SFTP client and connect to your hosting account using your SFTP connection details. You can get them from your host if you don’t have them already. For some hosting providers, the SFTP logins are the same as the cPanel details.

Once you’re connected, browse to the public_html or www folder (or a folder at the root where you want to install your WordPress website) and copy all files from your WordPress installation folder on the local server to this directory on the live server.

The final step is to modify the permalink structure of your new website to match that of your old site on the local server. To do this, go to the admin dashboard of your new website and browse to Settings > Permalinks. Select the structure you used for your local installation and save. Your WordPress website should now be live.


By now you should have proper insight on what happens when moving a local WordPress installation to a live server. WordPress allows for a lot of flexibility and ease of use. Developing on localhost allows for unlimited tweaks and customizations because you can afford to make mistakes there that you cannot afford to make in a live, production environment.

What’s your best method for uploading a WordPress website from local host to live server? If you’ve gone through this process before, what was your experience like? Please share your thoughts in the comments!

wordpress-local-to-live
Article by Tom Ewer WPExplorer.com guest author
Subscribe to the Newsletter

Get our latest news, tutorials, guides, tips & deals delivered to your inbox.

54 Comments

  1. Ovidiu NicolaeOvidiu

    Or you could you the AWESOME duplicator plugin. 🙂

  2. nemanjaj

    Xcloner plugin is a backup-restore solution i use for migrating a WP site. It is flexible in sense that it allows you to micromanage which files you will move, and it handles both sql backup and file backup. The restoration process is simple enough, although you still need ftp access and of course a destination db.

  3. Steve Eldridge

    You could just install a fresh WordPress server and install All-in-one Migration on both the local and target destinations. This tool will copy the theme, database and plug-ins and install the full build taking care of everything you just mentioned above in one easy step.

    https://wordpress.org/plugins/all-in-one-wp-migration/

    • Mehdi

      I know the “all in one migration” plugin used to work great but with the latest update, it doesn’t migrate the whole website. I tried it so many times and it still do the job. Do you have any suggestions? Thank you.

    • kickassdigitalmarketing

      I also use All-in-one Migration ! Super Simple and Easy. Just EXPORT from LOCAL and IMPORT to SERVER.

    • Yaron

      This advice saved me! After trying three or more failed options, I just picked up this plugin and within 10 minutes all was done correctly with no fuss and just 4 clicks. Thanks!

    • Lokesh

      Yes, All-in-one Migration plugin is best

    • John Gomes

      the free one do not sopport miltisite

  4. ducnghia0105

    duplicator plugin using for newbie…
    some host free not support this plugin…

  5. Ellis

    My website is uploaded to server true FTP. but when i go to my site link and visite my site, than i enter; /wp-admin it goes to localhost, and i cant enter the wordpress admin on the server? hows that? :O cant find it ;(

  6. powographix

    This article was very helpful when I was migrating a local website to a live server for the very first time. Kudos man.

  7. nath.grech@gmail.com

    this is awesome, i get this error? “Unable to open WampServer’s config file, please change path in index.php file” Not sure if this thread is still alive.

    • Andrew Lyndem

      I think you moved the WampServer’s default index.php too along with your wordpress site. Just try renaming it to some other name (e.g. index-test.php) and see if you still get that error. If the error doesn’t come up anymore, then you can delete that renamed php file.

  8. Albert

    You could also use akeeba backup for WordPress it kinda automates the process for you including the path modifications and all

  9. nilaysanganiNilay

    Dear Sir,
    I have followed your steps till the end.
    However, after I have uploaded my front end files, when I navigate to my domain site to login to the admin, I am redirected to the wp admin installation page.
    Is this correct? I feel somewhere I have done some mistake.
    Please advise.
    Thanks

  10. faizan

    great man u make my day

  11. Rich

    I would like more info on where to upload the site files using fillzilla or cyberduck please

    • Kyla

      The WordPress Codex has a great FileZilla guide for using FTP to upload WordPress files, and they have a WordPress installation guide using CyberDuck but I couldn’t find a simple FTP guide for it… Hope this helps!

  12. Olisa Macaulay

    thank you very much, it work for me

  13. caralandicho

    I forgot to save the old values for my local wp-config file. Now I can’t establish a connection with it. Is there a way to change it through phpmyadmin?

  14. Kbam7

    I suggest using All-in-one WP Migration. Its ridiculously easy to use and it works! First tie! No problems!

    https://wordpress.org/plugins/all-in-one-wp-migration/

  15. ERDCV

    I created the export file but there are no instructions how to import this file into your localhost. The import option seems to apply only to import the file into the live site after it has been saved in some place (clould, google drive, etc).

  16. Fabrizio Del Tufo

    I follow this procedure , but I still continue to loose the setup of theme, on local all is perfect, after ftp all online and setup of wp-config.php with correct parameters for db, I export, replace path and import on online db but the results is always the same, my online website is ok for the contents i wrote except for customisation theme, it returns to his default, any ideas ? thanks in advance ….

    • Tom Ewer

      Hi,

      Yes, you’re right. In order to import the file, you have to log in to a website where WordPress is already running, so you may need to install it first.

      Cheers,

      Tom

    • Tom Ewer

      Hi Fabrizio,

      That may happen when you use Method 1. Give Method 2 a try, and don’t forget to transfer all of the tables in the database.

      Cheers,

      Tom

  17. Farii

    Thanks For This Information

  18. Abid Naimat

    Really my initial introduction about your site is phenomenal. Much obliged for the greater part of the instructional exercises. This instructional exercise is additionally awesome. Much obliged once more… 🙂

  19. Alcides Apaza Yanarico

    Thanks Tom, I tried all the afternoon to do this process following at least 3 different methods without success, but with “Fix wp-config.php File” I realized my failure. This really works! =)

  20. Darrell Ring

    I don’t understand how method one can work(Method 1: Export Content Using Built-in WordPress Tools). Does it also grab the mysql database files? And the media files? how are they uploaded in the process?

  21. Indra Gotamey

    Method 2 is real smooth. Got it working in the first try itself. Thanks for posting this article. I have been wrecking my head for quite sometime regarding this issue. Thank you..

  22. Christian Mauerer

    Saved my day! Thank you Sir!

  23. Tom Ewer

    Hi Nilay,

    Without actually seeing everything, I really can’t help you much, but it seems WordPress may either be missing its configuration file or unable to find the required data on the database. Try checking these.

    Cheers,

    Tom

  24. tkcgospel

    Your idea was the best…i did all from rewrite rules to changing .htaccess permissions yet it didnt work i also used the sql script injections but no positive results until i manually download the sql file from my cpanel and did the find and replace method.

    God bless you man.

  25. Tiến Tài Đoàn

    Thank you for the useful post!!

    I wonder if there is any other better way if I wanna sync my website from localhost (xampp) to my live site once per day? Is there any tool can help?

  26. Xavier

    Thank you very much for your useful and well explained post! After many tries trying to upload successfully my wordpress (and making me crazy), I get it at the first with your tutorial. Best

  27. km

    Great article! How do you go about the last step of swapping the current live site for the one at the newly added /my_test directory? Any path issues to be aware of when making the swap? What about using a subdomain to upload the test site to instead of a test directory in the root?

  28. Marko

    Fantastic tutorial! It took me some trial and error for process to work on free hosting services but these 7 steps are golden rule to migration process. If Duplicator plugin is not working for some reason this here is all the knowledge you need in order to migrate to live server successfully. Big thanks!

  29. Alok

    today i am follow your tutorials to the end but my site is not online .please help me

  30. AmirRzd

    I did all of the above but faced 500 Internal Server Error. Then I deleted .htaccess file and it worked. Thank you for the “Replace” tip.

  31. Hari Kumar

    my site isn’t live yet!
    I’ve completed all the process but still no result..

    • AJ Clarke

      Are you getting any sort of errors?

  32. Hari Kumar

    Someone please help me,
    I don’t want to change my domain i just wanted to move my wordpress to new cpanel…

    I created MySQL Database, username and password. Added that user to database and granted all privileges..
    Then updated my wp-config with new database and user/pass.

    Up-loaded the both sql files through phpMyAdmin and wordpress files through filezilla in public_html.

    Now when i open my blog it redirect to mydomain.com/ “cgi-sys/defaultwebpage.cgi” <<<
    It says!!
    1. The IP address has changed. – ip address of this domain may have changed recently..
    2. There has been a server misconfiguration. – verify that your hosting provider has the correct IP address configured for your Apache settings and DNS records
    3. The site may have moved to a different server.

    • AJ Clarke

      If you switched to a different cPanel then the IP address may have changed so you need to make sure your domain is pointing to the correct location otherwise you will get DNS issues. If you contact your webhost they should be able to assist with this.

  33. Hari Kumar

    Hello, AJ Clarke!!
    I have a question,
    while uploading wordpress files do I need to create a new folder in Public_html to place my files??

    Or i just need to upload all the files in public_html??

    • AJ Clarke

      You should be placing the files in the root directory. If you don’t have WordPress installed then you can migrate all the files from the localhost if WordPress is already installed on the server then you only need to move the wp-content folder because this is what has all your uploads, themes and plugins.

  34. Mohd Hasan

    Sir i followed all instruction but my site is goning to istallation directory

    • AJ Clarke

      Sorry I don’t quite understand what you mean, care to explain?

  35. Mark Winwood

    Actually Tom, you know what? I’ve just read your article again in case I missed anything…and I did. Considering the bulk of the site moved over I don’t think a little more work updating manually what it missed the first time round is going to hurt me is it? No. So thank you once again and when I’m a bit more savvy I’ll try Method 2.

  36. vricop

    Great post! You just saved my day! I was getting errors while I was trying to import the database, Database noob 🙁

  37. Mr CA Parkin

    Worked like a charm! Thanks!

  38. Reef

    The best i have found on this so far, Thank you a million.

  39. rakesh kumar

    I am able to migrate the whole website using built in Export and Import Tools the only Issue I find it its media. This whole process does not export or import the media files properly. Media files are partially exported or corrupted. Do you people have any idea how to do this.

    • Kyla

      Hmmm… if you’re having trouble exporting/importing your images you may just have too many for your server to handle. I know I’ve personally encountered import issues before when trying to upload very large sample data files (lots of posts, images, products, etc) to a test site that was using a shared hosting plan. Try exporting/importing the sections separately (posts, pages, products, media, etc), perhaps that will work?

  40. Amit Shee

    Thank you very much for your useful and well explained post! After many tries trying to upload successfully my wordpress. You just saved my day!

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

Learn how your comment data is processed by viewing our privacy policy here.