In looking for a way to setup a local version of the JISC Involve WordPress network that support, I learned a few things that might be of interest to others doing this kind of thing. The end point I eventually got to was having a local clone of the network running under XAMPP using Apache virtual hosts so that it can be accessed using the live site URL. Why does that help? Well, it avoids faffing on with database and config changes that are OK as a one off, but you wouldn’t want to have to do regularly.

Why bother?

XAMPP provides a nice way setup a local WordPress environment for testing and development. However, if you want more than just a standalone site or network to play around with, such as a clone of a live site that you want to keep synchronized, that can be more tricky.

Normally with XAMPP, you’d need to access everything via http://localhost. So, taking this site as an example, my local version of it is installed in XAMPP for Windows at


Which is accessed in a browser at


By setting up Apache virtual hosts, you can redirect requests to the live site to localhost. This means we can access our local install at the live URL (http://sboneham/blog). So when I import my database and copy over the site files, I have a clone of the live site that is good to go and has all the links, images and plugins working locally.

Generic method (how to clone any old WordPress site)

Assumptions: I’m working on Windows (7), so writing this assuming you are too. I really should look into the Mac option as I read that MAMP (pro) lets you do this through the UI. I also assume you know how to install WordPress under XAMPP, so won’t cover that here.

We need to make changes to your XAMPP apache config file and your Windows hosts file (requires admin rights).

XAMPP Apache config

1. In a text editor open the file:


2. Remove the hash # from the following line to activate name based virtual hosts

# NameVirtualHost *:80

3. Now, at the bottom of the file enter the code:

<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\sboneham"
<Directory "C:\xampp\htdocs\sboneham">
Order allow,deny
Allow from all
AllowOverride Fileinfo Options

This tells Apache to redirect browser calls to to be served from my local site folder xampp\htdocs\sboneham. You’ll need to replace those values with your own site URL(s) and folder names. The folder name doesn’t need to match the live site name, so some people prefer a local naming convention like or sboneham.loc to differentiate the live and local sites.

Windows Hosts file

1. In a text editor open the file:


2. At the bottom of the file add the code:

3. Start (or restart if running) Apache to pickup the new config.

4. Install WordPress locally and import your database into mysql. Use the same name for the local database to avoid the need to change this in your wp-config.php. You may still need to change the mysql database account details in here, unless you recreate your live site account locally.

You should now be able to hit the live URL for your site and be served your local WordPress install.

Cloning a large network

There were a few issues I had to address to clone JISC Involve that might affect you if you are cloning a network with sub-domains or that has a large database (shared by all sites in the network).

Importing a large database with phpMyAdmin

The first issue I had is that file is ~2Gb and so too large to import to a blank mySQL database via phpmyadmin (the default limit is 2MB). To increase this, you need to edit php.ini file as below.

1. In your text editor, open the file


2. Search for and replace the entries ‘post_max_size’ and ‘upload_max_filesize’, changing their values from 2M as appropriate for your database.

3. Save the file and restart apache. phpMyAdmin will now show your new limit on the database import page.

Attempting an import at this point highlighted a second issue. The upload timed out. While this should fail gracefully, in practice I found it didn’t, so had to remove the timeout limit as follows.

1. In php.ini, edit the entries ‘max_execution_time’ and ‘max_input_time’ and change these from their default value of 60 (seconds) to something more appropriate. I used 5000, which was enough.

I also had to change the phpMyAdmin config file as follows:

2. In your text editor, open the file

$cfg['Servers'][$i]['ExecTimeLimit'] = 0;

This removes the time limit. Save the file and restart apache again. You can now import your database while you get a coffee as this might take a while.

(Note, when researching this stuff, other posts said use this phpmyadmin config “$cfg[‘ExecTimeLimit’] = 0;” but the format above was the one that worked for me.)

Network sub-domains

The network I was cloning uses sub-domains, so the sites in the network have URLs like and On a live site, these redirect using wildcard sub-domains (i.e. *, but AFAIK, you can’t use wildcards in a Windows hosts file. Instead, you have to add a new redirect to your hosts file for each sub-domain, such as:

That is good enough for me, but if that seems like a pain for you, Stack overflow has a question on this with replies pointing to OSS software for proxy DNS server that allows wildcards in a custom hosts that might help automate this.

So, now I have a workflow (file sync via SVN & database reimports) for taking snapshots of a live site and cloning it locally. I’m hoping plugins like Duplicator (hat tip to Mike Ellis) will make this kind of thing easier in future, but in my testing with several multisite networks I couldn’t get it to work properly.


Setting up Virtual Hosts for WordPress Multisite with XAMPP running on Windows 7 is a great post that got me most of the way with doing this.

The rest was pieced together from stuff that I barely understood in Apache documentation and server admin forums. I hope I’ve managed to compile that into something useful for those of us that just want to get on with using WordPress.

Featured image cat5 cable by nrkbeta (CC BY|SA)

Related posts: