I have been working with WordPress from past 5+ years and have been doing most of the WordPress customizations lik WordPress Plugins and theme. Also I have worked with many sites based on wordpress multisite (WPMU). I started another WPMU project, since this time I started it on Local Windows based laptop, I was about to setup it locally and face issue setting WPMU locally. Googling it didn’t helped much but yeah it does give me idea to setup it locally. Most of the blogs/forums online including wordpress.org support forums states that WPMU cannot be installed on localhost. but don’t loose hope we can still install wordpress on localhost using virtual hosts on localhost.

Most non-technical people might not know that from WordPress 3.x onwards supports multi user blogging in the its core itself. This makes it pretty much easier for almost everyone to use the wordpress and setup multiple sites, moreover anyone can enjoy the befits provided by wordpress multisites with a simple wordpress installtion.

In this Post I’ll try to clear the followings:

  1. Setup localhost as Virtual hosts to disguise wordpress for name
  2. Setup and run WordPress 3.x to run on localhost Virtual Host
  3. brief intro to WPMU admin interface.

The reasons why one cannot install and configure WordPress 3.X to run on localhost or on the IP Address But we can fool wordpress by making some simple entries in your HOSTS file as a work around. We have to do this because WordPress multisite looks for actual domains and resolve them based on DNS. in WordPress multiple sites setup, each Site/Blog should be configured to run as a subdomain or main domain, and this is where localhost fails to deliver WordPress it’s required structure.

we’ll be working it as a subdomains based WPMU setup. In this case, suppose Main Blog is setup on dmarkweb.com and we have 2 other sites/blogs setup as 2 subdomains blog.dmarkweb.com and downloads.dmarkweb.com. This setup can be done easily on Live webserver but Localhost doesn’t support it by default. since Apache is not confgured that way.

So now we have to use Apache’s support of Virtual Hosts. Where we can configure apache to understand URL’s like above. Let’s start on this.

Assuming my local web server document root is: “/www/”

Now let’s go and do the magic 🙂

Here is what a typical virtual host, set of instructions, to Apache should read like when setting up WordPress to work as a Multi User / Multi Blog in a virtual domain. Following lines should be added to apache configureation file “httd-vhosts.conf”.


NameVirtualHost *

<VirtualHost *>
    DocumentRoot "/www"
    ServerName dmarkweb.com
    ServerAlias *.dmarkweb.com
    ErrorLog "/www/errors.log"
    <Directory "/www">
	Order allow,deny
	Allow from all

<VirtualHost *>
    DocumentRoot "/www/downloads"
    ServerName downloads.dmarkweb.com
    ServerAlias *.downloads.dmarkweb.com
    ErrorLog "/www/downloads/errors.log"
    <Directory "/www/downloads">
	Order allow,deny
	Allow from all

NOTE: some people prefer using <VirtualHost *.80> instead <VirtualHost *> but it works for me and you can copy the code blocks for other hosts/domain/subdomains

Now we’ll look into code above:

in each virtual host we are guiding apache with info required DocumentRoot "/www" tells apache that
ServerName dmarkweb.com and in next line .dmarkweb.com informs Apache that there will be multiple aliases used with this specific URL.

Now there’s one thing needed to ensure that the ServerName directive in the httd-vhosts.conf file is set to dmarkweb.com and not to www.dmarkweb.com as is often the case and ServerAlias directive is set to *.dmarkweb.com.

Since we are all setup with the apache virtual hosts now the next issue you have to tackle is Domain Name Resolution, which normally requires a Domain Name Server which has the appropriate domain name / ip mapping and offers such resolution to any Browser that requires it.

Well here’s the thing, all Browsers always reference the HOSTS file on the local computer first for domain name resolution before broadcasting the URL on the Internet and waiting for a DNS server to reply with an IP address. Which is just perfect, because you now have a perfect place to do your own domain name resolution on your local desktop or laptop i.e. it’s HOSTS file on your operating system.

In Windows the HOSTS file is normally found in:


In Linux the HOSTS file is normally found in:


Open the hosts file in your favorite text editor and ensure that it contains the following entries.              localhost              localhost.localdomain

Now we need to tell our hosts file to point our domains to localhost IP i.e              dmarkweb.com              blog.dmarkweb.com              downloads.dmarkweb.com

Copy paste above lines of code to your hosts file.

Your host file entries should look like this:             localhost             dmarkweb.com             blog.dmarkweb.com             downloads.dmarkweb.com

( Notice the localhost.localdomain section is deleted )

NOTE: The separator between the ip and the domain being a TAB.

This approach will really take care of all the DNS resolution that you might need when testing WordPress out in multi Blog / multi user mode on your local computer.

Now we have everything setup to install wordpress multisite on localhost.

Now restart your Apache Web Server if already running, or start otherwise.

open your browser and visit any of the above configured domains. i.e. in our case http://dmarkweb.com or http://downloads.dmarkweb.com.

you’ll see it’s pointing to your localhost directories.

Now grab the latest copy of WordPress and do a fresh WordPress installation. after you done installing wordpress. like I said earlier WordPress 3.x core does support Multi-Sites. Now we have to setup wordpress Multi-Sites in our local wordpress installation. you can follow instructions for that here Setting UP wordpress Multi-Sites.

Thanks for reading. Do post your comments and problems if any. I’ll be glad to help.

Written by Deepak Oberoi
Deepak Oberoi is a technical blogger.