Virtual Host using WAMP server

First thing you need to do is install a latest wamp server on your system.
Once setup is done. Start the WAMP server.
Default link to access WAMP server is http://localhost/.
Now if you create a new website folder under htdocs named website so the default link to run the new project is http://localhost/website
If you want to rename the link from http://localhost/website to suppose http://website.com that is creating a virtual host you need to follow below steps:

  1. Goto your My Computer > C > windows > system32 > drivers > etc
    Edit hosts file using admin rights
  2. Once hosts file is opened. Right at bottom of file add following code
    127.0.0.1 website.com
    website.com is host name which i want to run as and save the file
  3. Then, Go to wamp installation folder: apache >conf  > extra
    and edit httpd-vhosts.conf file
  4. Once file is opened as following code at bottom of file. This code gives permission to virtual host to folder
    <directory C:/wamp/www>
    Order Deny, Allow
    Allow from all
    </Directory>
    <VirtualHost *:80>
    DocumentRoot “C:\wamp\www\website”
    Servername website.com
    </VirtualHost>
  5. Now restart your server and run host as http://website.com and it will point to www/website folder.