Migrate WordPress to Your Local Server

1. Install XAMPP or WAMP on your local machine. I prefer XAMPP but either one should work for our purposes. This tutorial will assume you already have your localhost environment configured.

2. Go to WordPress.org and download the latest version of WordPress.

3. Unzip the downloaded copy into the root web folder of your local machine. Change the name of the extracted folder from WordPress to something that makes more sense to you. For the purpose of this tutorial I will use the URL: http://localhost/blog.

4. FTP to the root directory of the live WordPress site you want to copy.

5. Open the wp-content folder on your live site. Find the folder which houses your current theme and drag and drop the entire theme from your live wp-content folder to the corresponding local root wp-content folder. Next, find the folder called ‘uploads’ also in your wp-content folder and bring that over as well, this is the folder with all your images and uploaded files. Finally copy over the ‘plugins’ folder.

6. Login to your hosting account and find PHPMyAdmin. Export the the entire database which is associated with your current WordPress site. If you encounter multiple databases and don’t know which one is the right database you can find the name of the correct database to export in your wp-config.php file, in the root directory of your live site.

7. Export the entire database in SQL format using the default PHPMyAdmin settings.

8. Save the resulting exported SQL file to your local machine.

9. In your local XAMPP or WAMP server navigate to your local install of PHPMyAdmin. The default username is root and there is no password set. Feel free to use this configuration since we are not concerned with security, this being a local version of the site.

10. Create a new database using PHPMyAdmin.

11. This part next step is very important. If you don’t follow these steps most likely your local development copy won’t work.

  • Open your exported SQL file in a text editor like Note ++.
  • Do a search  for the current live site URL and replace every value with your localhost URL.
  • For example, if your live site is: my_live_site.com. Search for this domain and replace all occurrences of it with your localhost URL:  http://localhost/blog (in this example). Make sure to save your changes.

11. Go back to your local PHPMyAdmin and click into the DB you just created. Go to the import tab. Select the SQL file you were just searching and replacing in and import that file. If you get a message saying that file is too big you can increase the upload size limit on your local server by editing the following parameters in your PHP.ini file. 


The settings above will allow database imports of SQL files up to 512MB. Feel free to increase the size if your DB is bigger. Another alternative is to open up the SQL file you downloaded with a text editor and split the SQL code into separate smaller uploads (I like note ++).

12. Once your database is imported, go to your local root directory and find the wp-config.php file. If you extracted a fresh new version of WordPress like instructed above you will find wp-config-sample.php instead. Just rename this file to wp-config.php. Open the file and enter the database information for your local server. Remember your default local server information has the username root and does not have a password. You should leave the password field between the single quotes empty. If you have a username and password configured for your local MySQL server then you can enter that instead. Make the appropriate changes and save the file. 

14. Open your browser and navigate to your site which should now be at  http://localhost/blog. Congratulations! Your site should now be there. Login to the backend and confirm that everything is OK. If things are broken take a look below for a possible solution.


1. Database Connection Error– If you get a database connection error make sure to double check your wp-config.php file for typos or missing quotes. 90% of the time it is a typo. If you are certain there are no typos or syntax errors  try using WordPress to regenerate your wp-config.php file. To do this rename or delete your current local wp-config.php file. Go back to your address bar and navigate to your site. You will now get a message from WordPress telling you that your config file does not exist. Follow the prompts provided to recreate the file.

2. Missing Images and Broken Links– Make sure you follow Step 11. There is probably a broken or missing path. You can use FireBug or a similar developer tool to see what links are broken. In many cases I have found that a broken image, link is due to the site using relative links and not absolute links. Try finding the template or style sheet with the broken link and try using and absolute link instead. For example,  http://localhost/blog/wp-content/images/my_image.png instead of /wp-content/images/my_image.png.

3. Broken pages or WSOD (White Screen of Death) – In many cases if the original live site had a custom permalink structure this can cause havoc on your local install. Try changing the permalink structure in the WordPress back-end to the default.  This usually ends up solving most display problems when going from a live site to a local development site.

Hope this helped someone. Please feel free to comment below.

Thanks for reading!