Running a Web server on your desktop computer is a great way to speed up Web site development. By previewing your Web pages directly through a Web server on your own computer you can test out server-side programming like server-side include files, form processing scripts, or database-driven Web pages. However, there’s one problem associated with running a server on your own computer: by default, you only have a single "domain"–http://localhost/–so if you work on more than one Web site you put them all under "localhost" in different directories. It may cause some problems when using server-side inclue and root-relative links. By setting up virtual host, you can have the separate domain name like in the real world when your site is deployed.

 There are two steps:
  1. Edit computer's  hosts file 
  2. Edit the Apache configuration file to accept Virtual Hosts and define the particular Virtual Hosts you want to setup on your computer.

1. Edit computer's hosts file

 Open you computer's hosts file.
 For Windows ( XP, Vista, Windows 7 32 bit, Windows 7 64 bit)

At the end of file, add YOURDOMAIN.local with is IP address that point back to computer ( just like it says me ).
and YOURDOMAIN.local is the domain name that you want to declare. anything you want such as test.local, mysite.local, etc...

2. Edit the Apache configuration file

Open httpd-vhosts.conf in extra folder of apache. For Windows

Add the followings at the bottom of file :
NameVirtualHost *:80
<virtualhost *:80>
    DocumentRoot "C:/xampp/htdocs/"
    ServerName localhost
<virtualhost *:80>  
    DocumentRoot "Your_folder_path"
    ServerName YOURDOMAIN.local
Save file and restart apache server. Done !