Scenario
assuming you want to add your site, located in D:\Websites\Samplesite to be its own virtual host so that when you run XAMPP you can view your Samplesite with this url http://samplesite.local.
this tutorial assumes you have installed XAMPP in the default directory i.e. C:\xampp.
Solution
step1
in open hosts. under 127.0.0.1 localhost paste these :
step2
in
open httpd-vhosts.conf and paste this right at the bottom of the file:
this turns on virtual hosts and retains xampp’s original admin interface.
step3
to specify your own virtual host, simply paste the following and change DocumentRoot, ServerName, ServerAlias and <directory "location"> to setup your virtual url.