Running a WordPress site locally using WAMP

The WAMP server menu visible from the task bar

WAMP server

When working with any site it is important to have a development environment. With WordPress there can be conflicts with WordPress versions and plugins. It is also vital to be able to test code before making it live. I am documenting here how I run a local development environment and populate it with a live site.
These instructions work and have been tested on Windows 8 and 10.
First step is to install WAMP. You will need to allow it to pass through your firewall. When it is installed and you run it there will be an icon in the taskbar that will turn green if successful.

Note:  If the icon won’t turn green then there could e another process running on port 80. Skype will interfere so you may want to close it down. Alternatively you can set up WAMP to listen on a different port. To do this you will need to:

  1. Edit C:\wamp\bin\apache\apacheX.X.X\conf\httpd.conf
  2. Change the two Listen lines to use port 8080 instead of 80
  3. Change localhost:80 to localhost:8080
  4. Use :8080 after URLs

Now you need to get a copy of your WordPress site:

  1. Export and download your database
  2. On your live Wordress site, zip wp­admin, wp­content and wp­includes as well as any files beginning with wp­ in root and index.php
  3. Download the zip file from the above step and be sure to remove it from the server
  4. Create a folder in c:\wamp\www called yourwebsite
  5. Unzip the live WordPress files to the folder you just created
  6. Create a database using http://localhost/phpmyadmin/ the database name will be the same as the database listed in your wp-config.php file
  7. Import the database file exported from the live site in step 1
  8. Update C:\wamp\www\yourwebsite\wp_config.php, change user to “root” and empty password
  9. Edit C:\wamp\bin\apache\apacheX.X.X\conf\httpd.conf change DocumentRoot “c:/wamp/www/” to DocumentRoot “c:/wamp/www/yourwebsite/”
  10. In the apache modules (from clicking on WAMP in the taskbar and choosing apache > modules ensure rewrite_module is enabled
  11. Using http://localhost/phpmyadmin/ run the SQL script at the end of this list. This is important as all the links in the database will be pointing at your live server.
  12. See if the site works: http://localhost (ot http://localhost:8080 if you canged port numbers)
  13. In admin panel go to settings / permalinks and save. This will overcome page not found on child links

These steps should work to get a local development environment working. It will not send emails, so if that is required you may want to try using Test Mail Server Tool

SQL Script to fix links

You need to ensure you replace with your website name

UPDATE wp_options SET option_value = replace(option_value, ‘’, ‘http://localhost’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE wp_posts SET post_content = replace(post_content, ‘’, ‘http://localhost’);
UPDATE wp_postmeta SET meta_value = replace(meta_value,’’,’http://localhost’);
update wp_posts set post_content = replace(post_content, ‘’, ‘http://localhost’) where instr(post_content, ‘’) > 0;
update wp_posts set post_content = replace(post_content, ‘’, ‘http://localhost/’) where instr(post_content, ‘’) > 0;
update wp_links set link_url = replace(link_url, ‘’, ‘http://localhost/’) where instr(link_url, ‘’) > 0;
update wp_links set link_url = replace(link_url, ‘’, ‘http://localhost/’) where instr(link_url, ‘’) > 0;
update wp_links set link_url = replace(link_url, ‘’, ‘http://localhost/’) where instr(link_url, ‘’) > 0;

Alternatively you can use a text editor to do a find and replace on the SQL file before you import it. If using Notepad++ the following will work well, assuming your site is

Find (using Regulat expression): http?://(www\.)?[^\s”]*)

Replace: http://localhost/example\2

And that’s it!

Good luck. The main issues I have come across are that:

WAMP won’t start – you will need to check what else is running on the same port

Internal links are broken – Make sure to go to settings > permalinks and press save, and that you updated the SQL script before running it.


A few years ago I created a Visual Studio Tools for Office (VSTO) application called Wikipediaize which will take a user defined dictionary of acronyms and create a table of acronyms/abbreviations as well as an option to hyperlink them.  When I migrated my blog I didn’t migrate all the old posts, so a lot of the programming code didn’t come across.

The technology may be a little old now, but I notice people are still trying to access it and I have had a request for the code, I have included it here as a download. Please feel free to use it and adapt it and credit me. There is no support as I am no longer actively programming. When I get some time I will hunt down the original article about how it is set up, but it should be reasonably clear from the code. Here it is: Focas.NET.Wikipediaise