• Home
  • Wordpress
  • Working with WordPress multisite sub-domain install on localserver in WAMP

Working with WordPress multisite sub-domain install on localserver in WAMP

While I was trying to set this up, I came across multiple articles, but none worked correctly for me.

Details of Localserver: Windows 7 64 bit system

WAMP installed to c:\wamp

 

You need to make two major changes to get a subdomain localhost install of WordPress running correctly. These are changes to your hosts file and the Apache httpd.conf file

Location:

HOSTS FILE:

C:\Windows\System32\drivers\etc

Alternate generic location: %systemroot%\system32\drivers\etc\

Linux: /etc/hosts

HTTPD.CONF FILE:

httpd.conf: C:\wamp\bin\apache\apache2.4.2\conf

On Ubuntu the main Apache configuration file is actually apache2.confApache2.confcontains the default configuration for Apache on Ubuntu. Apache2.conf includeshttpd.conf for “user configurations”. Here’s the lines from apache2.conf that includehttpd.conf:

# Include all the user configurations:
Include /etc/apache2/httpd.conf[/code]
So use httpd.conf to add extra Apache configuration, and modify apache2.conf if you need to change the existing Apache configuration.

Ubuntu’s Httpd.conf Location

For the versions of Ubuntu we’ve checked so far, you can consistently find httpd.conf in the directory /etc/apache2.   I needed to get www.droidzone.in, supernova.droidzone.in working in localhost. So the example will be this. The hosts file needs the following changes:
127.0.0.1 www.droidzone.in

127.0.0.1 supernova.droidzone.in

Note that http://droidzone.in in real time points to www.droidzone.in by means of an A record. So what applies to www.droidzone.in applies to droidzone.in. The address has to be a.b.c and not just b.c. So adding www before droidzone.in is a must.

So now that the addresses are pointed to localhost represented by 127.0.0.1, we need to setup httpd.conf. Click on th WAMP icon in the tray>Apache>httpd.conf (See figure)

 

 

 

 

 

 

 

 

 

 

The file opens in Notepad in a window.

Next, at the end of this file, add the following:

<VirtualHost *:80>
 ServerName www.droidzone.in
 DocumentRoot "C:\wamp\www"
 DirectoryIndex index.php index.html index.html index.htm index.shtml
</VirtualHost>

<VirtualHost *:80>
 ServerName supernova.droidzone.in
 DocumentRoot "C:\wamp\www"
 DirectoryIndex index.php index.html index.html index.htm index.shtml
</VirtualHost>

Note that C:\wamp\www is the directory where I have put my WordPress installation. That is, the directories wp-admin and wp-content, along with the file wp-config.php are contained within this directory.

Once these files have been modified, you should restart Apache.