Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Move a Live WordPress Site to Local Server

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Move a Live WordPress Site to Local Server

After learning how easy it is to install WordPress on local server in Windows or Mac, some of our beginner level readers asked us how they can move their live WordPress site to local server. We have previously showed you how to move a a WordPress site from local server to live site. This article is an exact opposite of that. In this article, we will show you how to move a live WordPress site to local server.

Why and Who Would Want to Move a live WordPress Site to Local Server?

A lot of people create a copy of their live site on local server to test new themes, plugins, or do development testing. This allows you to set up your theme with all your content and test all the features without worrying about breaking your site. Many users copy their site to local server to practice their WordPress and coding skills with actual site data.

Even though you can do all the testing with dummy content in WordPress, real site data gives you a better visual representation of how these changes will appear on your live site.

Important: Whether you are moving your WordPress site to a new domain, or from WordPress.com to self hosted WordPress, or to your localhost, it is highly recommended that you backup your entire website first. We recommend using BackupBuddy to create backups. You can also backup your site using BackWPUp, or create a manual backup.

Moving Live WordPress Site to Local Server using Plugin

First thing you need to do is install and activate the Duplicator plugin on your live site. Duplicator plugin allows you to create duplicate package of your entire WordPress site. It can be used to move your WordPress site to a new location, and can also be used as a backup plugin. Upon activation, the plugin adds a new “Duplicator” menu item in your WordPress admin sidebar. Clicking on it will take you to the packages screen of the plugin.

Create a new package in the Duplicator plugin

To create a new package, you need to click on the create new package button. Duplicator will start creating a package of your entire WordPress site. This may take a while, depending on how much data you have on your live site. Once finished it will redirect you to the packages screen, showing newly created package with a installer file. To move your site you need to download both, the zip package, as well as the installer file to your computer.

Duplicator Zip Package and Installer file

Your local server site will need a new database, so you need to create a database on your local server using phpMyAdmin. Once you have created the database you need to copy paste the package and install file to an empty folder in your local server’s web directory. To run the installation script, you need to open the install file in your web browser. For example if you pasted both files in /test-site/ folder you will access them in your browser by visiting http://localhost/test-site/install.php. You will now see the Duplicator installation script like this:

Running duplicator install script on localserver

On this screen, you need to provide your local server’s database information. The host is usually the localhost. If you have not created a new user for MySQL on your site, then your username would be root. If you are using a password for the root user then enter that password, otherwise leave it blank. Lastly, you need to enter the database name you just created.

The installer will now extract your database and WordPress files from the zip package and import them. Depending on the size of package, this may take a while. Once the installer has extracted the files and imported database, it will redirect you to the update page.

Updating URLs in Duplicator plugin for WordPress

On the update page, you need to provide the URL of your live site and the URL of the site on your local server. The plugin will automatically detect these values make sure they are correct and then click on the update button. Duplicator plugin will now update URLs in your database.

Succesfully copied your live site to local server

That’s all, you have successfully moved your live site to local server. The installer will show you a success page. You would also need to update permalinks on your local server site and delete the installer file and package.

Manually Move a Live WordPress Site to Local Server

In case the plugin does not work for you, then you can always manually move your live site to local server. The first thing you would need is to back up your website manually. We have a tutorial on how to backup your WordPress database manually. We recommend using phpMyAdmin to export your WordPress database.

To export your live site’s WordPress database, you need to log into your cPanel dashboard and click on phpMyAdmin. Inside phpMyAdmin you need to select the database you want to export and then click on the export tab on the top.

Export tab in phpMyAdmin

phpMyAdmin will now ask you to choose either quick or custom export method. We recommend using custom method and choosing zip as the compression method. Sometimes WordPress plugins can create their own tables inside your WordPress database. If you are not using that plugin anymore, then the custom method allows you to exclude those tables. Leave rest of the options as they are and click on the Go button to download your database backup in zip format.

Custom export options in phpMyAdmin

Once you have downloaded your database backup, the next step is to download your WordPress files. To do that you need to connect to your WordPress site using an FTP client like Filezilla. Download all your WordPress files and folder to your computer. Downloading all your files may take a while depending on how much data you have on your website.

Download all your WordPress files and folders through FTP

After downloading your WordPress files, if you downloaded all your files and not just the wp-content directory then simply copy paste these files in your local server folder where you want to install WordPress.

On your local server, you need to create a database for your WordPress site. To do that you need to open http://localhost/phpmyadmin/ in your web browser and create a new database. After creating the database click on the Import tab on top. On the next screen you need to click on the Choose File button to select the WordPress database export file you downloaded earlier, and then click on the Go button. phpMyAdmin will now import your database and will show you a success message when it is done.

Importing your database through phpMyAdmin

Now that your database is all set up, you need to update the URLs inside your WordPress database referencing to your live site. You can do this by running an SQL query in phpMyAdmin. Make sure you have selected your local site’s database and then click on SQL. In phpMyAdmin’s SQL screen copy and paste this code, make sure that you replace example.com with your live site’s URL and localhost/test-site with the local server URL of your site.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.example.com', 'http://localhost/test-site') WHERE option_name = 'home' OR option_name = 'siteurl';
 
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.example.com', 'http://localhost/test-site');
 
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.example.com','http://localhost/test-site');

This query will replace refences to your live site’s URL from database and replace it with the localhost URL.

The final step is to update your local site’s wp-config.php file. You need to go to the folder where you installed WordPress on your local server and open wp-config.php file in a text editor like Notepad. Replace database name with the one you created in phpMyAdmin on your localhost. Replace the username with your local mysql username, usually it is root. If you have set password for mySQL user root on your localhost, then enter that password. Otherwise leave it empty and save your changes.

/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');

/** MySQL database username */
define('DB_USER', 'username_here');

/** MySQL database password */
define('DB_PASSWORD', 'password_here');

That’s all your live site is now copied to your local server, and you are ready to test drive it. We hope that you found this tutorial helpful. If you have any questions or feedback, then please leave a comment below.


Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. maarja says:

    Hi,

    Thank You for Your helpful directions.After a long while, I finally got the live page to my localhost with the plugin BUT for some reason, the content pages are not found on the server-all the information, texts etc is there in the back-office but aren’t shown in the front office except for the front page.
    Do You have any idea where/why the problem might occur?

    Thank You in advance,
    Maarja

  2. Yellow Canary says:

    Thank you very much :) I have done it manually… from a live server to localhost. With your instructions I have managed this for the first time. And I even know now how to do a SQL query in phpMyAdmin. I feel like a real pro!

  3. amna says:

    Hi,

    i followed all the steps but i am getting internal server error .

    I am confused in one step , after downloading the live site through filezill from godaddy host. i replace the wordpress folder with my live site folder i.e.

    C:/users/amna/wamp/www/wordpress/old folders

    with C:/users/amna/wamp/www/wordpress/mywebsite new folders

    please help i am a beginner

  4. Debenkumar Naorem says:

    Hi WEBBIGINNER SUPPORT, I followed the instruction for manual, it works very fine. Thanks for such intructions, I’ve been looking for this. Thanks again.

  5. Manish says:

    Hey! Thanks for the post.

    I followed manual instruction and replaced my site URL with localhost/name of blog . The problem I am facing is, no images are being loaded in my blog. All the uploaded images are there in upload folder. The text is absolutely fine. The images url have changed to localhost but they are not showing up.

    Could you please help me out in this?

  6. deepthi says:

    hi, i followed the manual procedure to check my wordpress website in localhost using xampp, i hav changed the site URL, home and the wp-posts and wp-postmeta. the problem is my home page loading fine in localhost. but when i go the pages in the menu the following error is coming.
    Object not found!

    The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

    If you think this is a server error, please contact the webmaster.

    Error 404

    localhost
    Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.5.15

    i logged into dashboard and can see all of the page content in the editing section, but from there also, when i try to view the page its reporting the same error.
    the url path it is taking is my updatedURL only,
    please reply with the solution

    • WPBeginner Support says:

      Go to Settings » Permalinks page and click on the ‘Save Changes’ button to update your permalinks.

  7. Peter says:

    After following the instructions to manually move the site, the home page displayed fine on localhost but none of the links worked. The page below said to “Go to settings/permalinks in the wordpress dashboard and update permalinks by clicking twice on save changes.” That fixed it.

    • Mohd Hasan says:

      I followed your steps , but only home page works fine and none of the links are working . Give The requested URL /akhdir3/category/health/ was not found on this server.

  8. Anes P A says:

    Dear Author,

    I tried your step. But problem is when loading a page the localhost refer online site and the Menu links point to the online web site. How it can solve ?

    Please advise.

    Thanks

    Anes

  9. Bhavana says:

    I have manually done all the above mentioned steps . But I am not getting the actual site which I want.There comes all uninstalled plugins in admin panel and the theme is also uncustomized. Where I am going wrong?

  10. Justin says:

    I’m trying to follow your instructions for a manual move.

    When trying to find/replace the live site’s address with my local host, SQL tells me there’s a syntax error.

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘)’ at line 1

    Are you sure the code is correct?

    • Justin says:

      Fixed my own problem….sort of.

      For some reason all my tables begin with wplm instead of just wp (wp_options = wplm_options for example). So updating the code to look for the correct table name allowed the script to run without errors.

      But….SQL reports “# MySQL returned an empty result set (i.e. zero rows)” and the values in the table didn’t get updated. I had to go in and update the links by hand. In my case this was only 2 values in wplm_options, but I could imagine some people will have a lot more links to check.

      Still, I do have my site imported now, and dealing with local hosting is a notoriously confusing process.
      Thanks for the clear and simple instructions!

  11. Lloyd says:

    The instructions for Duplicaor Installer begin with this line:
    “Your local server site will need a new database, so you need to create a database on your local server using phpMyAdmin.”
    Is creating a new database something simple like clicking a menu option, or is it so complex that it would require an extensive tutorial to explain?
    When I explore phpMyAdmin on Xampp, the only thing I see that looks like a possibility is under the Databases tab where it says:
    “Create database:
    (X) No Privileges”
    Is there an authorization problem, and if so where do I go to change that parameter?
    I have two web sites on this local host that seem to function properly, so I have assumed that the local host is set up correctly.

    Thanks for any help or suggestions,
    Lloyd

  12. Ashvani Kumar says:

    I am following the Manual option but when i go to Import Database page in phpMyAdmin then the max size for database upload is (Max: 2,048KiB) but my database backup size is 710MB. How do i increase this limit so that i can upload the database?

    Thanks

  13. Judy Williams says:

    I am trying this using Duplicator. I have downloaded my site and the installer. I have created a database using phpMyAdmin and have got to the bit ‘you need to copy and paste the package and install file to an empty folder in your local server’s web directory’. I have no idea how to do this! I have Filezilla and XAMPP installed on my laptop. Is there a tutorial on how to create an empty folder in my local server’s web directory? I am stuck now. Thanks

  14. german says:

    I’ve copied the files and database, when i try to access my localhost/test-site i get redirected to the dashboard. Any ideas why this could be happening?

  15. miguel says:

    thank you for the clear tutorial.
    although i’ve done the opposite (from localhost to public server) i thought the reverse would be equally simple.
    however, when it comes to connecting the database, i’m stumped. i’ve gone over the settings over and over without being able to connect.
    i even got into some trouble and got locked out of the database but fortunately got that resolved.
    in my config.php file i’ve changed the user to “root”, then set it to empty, used the user name from the public server and the same with the password. i have set the db name correctly to the localhost name.
    i can’t guess what i need to do.
    if you could give me a direction to look next, i’ll appreciate it greatly.
    thank you for you labor of love. it’s great to see so many people with the knowledge helping us those who look for answers.

  16. Daniel says:

    Hi

    I want to do this as well. Is this post written a few years back , still the approach to use or are the other plugins or post I should be looking at .

    Daniel

  17. Beatrix K. says:

    Hi everyone,

    Just wondering (please bare with me as I am new at this) – if I need to have have my local site to work with on two different devices, say my desktop and my laptop, is there a way for the changes I make on one device to be updated on the other device? I just want to know if it is possible to work from two different devices on the same project and not have to redo all of my changes. Thanks in advance for any insight :)

    B

  18. Muniba says:

    I am confused in step related to Filezeila ,,, how i will download my wordpress site using Filezeila..??

    • german says:

      download filezilla, establish a connection to your current host, productions site using filezilla. Once you have a connection you will be able to download the files to a local directory on your computer

      • Dee says:

        So with CPanel, for instance, we’d use the IP associated, our CPanel user and pass, along with “21” as the port value? After establishing a connection with Cpanel host, how can I transfer the files to my localhost while keeping the live site as well? Essentially, how do I create a duplicate with having the same site at both hosts (one to experiment with and one that remains live)?

      • Dee says:

        After successfully transferring files from remote to local, what is an easy way to bulk copy&paste (instead of manually one-by-one) the files to the local server where we want to install WordPress? I tried selecting all files to copy, but there is no copy function available. Please Help

  19. assal0le says:

    I want to copy my live wordpress site to my local wamp server, note moving it. My question is this will remove my live wordpress site if I follow this tutorial using duplicator plugin?

    Thx

  20. Ognatius Chironga says:

    I thank you so much!
    I found this article helpful.

    I almost restarted creating my site.

  21. Quy P says:

    I have tested and tried a number of time. It does not work untill i delete the .htaccess file on local. Thank you.

  22. Tobias says:

    If you are running a network of sites you should also update the column domain URL’s in the table wp_blogs.

  23. lorenzo says:

    Thank for this useful tutorial. I have to move manually my wp site, but if I type in the browser “http://localhost/phpmyadmin/” it doesn’t appear myphpadmin. Maybe I have to install it? How?
    Thank you very much…

  24. Dave says:

    In the wp-config.php file I also have to change the /**MySQL hostname */

    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);

    set if for localhost

  25. nicola says:

    Hi,
    i follow your step but the admin login is not visible…. error 404 not found. all the site is good in my local installation. how can i solve my problem?

  26. abdelouahad says:

    i did all the steps but i have always the error page i don’t know why some one can help me please

  27. Paul Denver Sy says:

    Thank you so much for this. It saved my almost a week of agony on running it on my local.

  28. Shilling says:

    Double checked all the steps and it all seems good, but I’m getting this error message when I go to the site on my local URL:

    Google Chrome’s connection attempt to localhost was rejected. The website may be down, or your network may not be properly configured.

    I don’t think the site is down. My local URL is auto flipping to http://localhost/wordpress-folder-name
    when I think it should go to http://localhost:888/wordpress-folder-name

    I’m hoping this is an obvious clue. I’m new at this and just have no idea.

    Any insight would be much appreciated.

  29. Ebert says:

    This was the clearest tutorial I found which helped me to copy a site I started with iPage to my laptop under localhost. The database was not imported but created a new local copy of the server database. I copied the data tables into my new database and modified the sql commands to match the table names and everything ran smoothly.
    I had to reuse the password I used on the live site with the local wordpress copy and I can now access and modify what I need to.
    Thanks and you just got another new subscriber to this great site. :)

    Also the post about BackWPup was very helpful as well. I tried to use Duplicator and it kept giving me error messages about permissions to create a backup folder on my machine. I used BackWPup and everything ran without a hitch. Thanks again!! :)

  30. Eduardo Weidman Barijan says:

    The manual process worked like a charm. Thank you.

  31. Alessio says:

    Hi guys,
    I’m trying to config the localhost on my computer with linux mint.
    i’ve already set up a new database, transferred the files with FTP to my local wordpress folder.
    Now I imported the db, but when I give the query to change the webaddress with a local address, it will give me a message “# MySQL returned an empty result set (i.e. zero rows)”.
    Now, if I type in the browser “localhost”, it will lead me to the online website…
    what should I do?
    thank you!

    • idriss says:

      Hey Allesio,

      Did you manage to solve this?

      I have the same issue. How did you manage to solve it?

      Thanks

      • Justin says:

        Same problem here.
        SQL is having trouble replacing the live site URL with the local host address.

        Without the updates to the database, WP tries to connect to the live site instead of the local site.

        Did either of you have any luck fixing this?

        • Sam says:

          Go to your localhost phpmyadmin and the database you are using for the site. Click wp_options and edit the siteurl and home. Replace the live url with the: localhost/ your-folder-name-goes-here

          That should do it.

          Sam

  32. Mike says:

    The first step worked with me.
    But how can I enter to localhost/test-site/wp-admin? It gives me an error message:

    Internal Server Error

  33. Wenke Adam says:

    Updating the local site’s wp-config.php file might not be the last step in this procedure. I followed your instructions and after some trials the public site was working (first I had a typo in the SQL queries and nothing happened) but still I couldn’t access wp-admin.

    The solution was to edit the wp_options table in the database. The first row had the wrong URL. I fixed this and finally everything was working fine, even the permalinks.

    Thanks for all these very nice and clear tutorials!

  34. Tim says:

    I am reposting this because it seems to have disappeared (at least on my end). So I am sorry if it is a double post.

    I am getting an error message when uploading the database. Any ideas?

    Thanks

  35. Tim says:

    When I try to upload the database I get a Red Error Screen. I can send a screenshot of the error if you would like.

    Thanks

    • WPBeginner Support says:

      Sure, you can upload the screenshot to a cloud hosting service like dropbox and paste the link as a reply to this comment. We will then take a look and will try to help.

  36. Ian Hyndman says:

    All day I have been trying to do this change with no effect !
    I even had to install word press again on my testing server. Was about to give up then I came across this. My other option was to manually copy and paste and install all the same plugins active on my host server to my testing server.
    When i read your post i finished in 5 minutes :):)

    Thank you for your tutorial, its just what I needed. !
    Well Done ;)

  37. Alexandros says:

    Two days i am trying to do this change alone with no effect !
    When i read your post i finished in 5 minutes :):)

    Thank you for everything !
    Keep up the great work ;)

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.