If you are a php developer and need to organized your website projects on certain folder with each individual host address e.g. "site1.web", "site2.web", you can use any name for virtual host but don't use ".com" extension as this will tell the browser to look the website on the internet and not on your local pc.

This procedure assume that you have already installed the apache for windows, php module for apache;

 open the apache configuration file, note that better to install the apache on the root of drive c (c:/apache/) to make it compatible for short naming folder, ok so assume your apache was installed on the root drive c:  so open the configuration file on c:/apache/conf/httpd.conf and enable the virtual host module, scroll down to near end of configuration and you will find this

# Virtual hosts
# Include conf/extra/httpd-vhosts.conf

uncomment the vhost module by removing the hash character on fron of it so it will look like this

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

ok save the file.

 open the virtual host configuration file on c/apache/conf/extra/httpd-vhost.conf  and add this on the top area

<Directory c:/website/>   
    Options Indexes FollowSymLinks
    Order Deny,Allow  
    Allow from all
</Directory>

where; c:/website is the root folder of all the site folder.

After the NameVirtualHost *:80 add this line below;

<VirtualHost *:80>
    ServerAdmin admin@localhost
    DocumentRoot c:/website/site1
    ServerName site1.web
    ErrorLog "error.log"
    CustomLog "access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin admin@localhost
    DocumentRoot c:/website/site2
    ServerName site2.web
    ErrorLog "error.log"
    CustomLog "access.log" common
</VirtualHost>

Save the file.

Configuration the windows host file for loop back address this will point your virtual host name to the local address,  go to c:\Windows\System32\drivers\etc  and find the "host" file

and add this configuration

127.0.0.1  site1.web

127.0.0.1  site2.web

and save the host file

Restart the apache usually from apache icon on the system tray, and after restarting just open your browser and enter the virtual host address e.g. site1.web

 

Note: the virtual host can only be access on your local pc so it cannot be access from other computer on the network, the only accessible is the top configured site treated as localhost, otherwise if you wish to access one of your virtual host to another computer you may change its port number aside from port 80