Open httpd.conf file present in C:\xampp\apache\conf\httpd.conf Remove the #(hash) sign present to include the “httpd-vhosts.conf” file in httpd.conf file.
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
To
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Create a virtualhost file. Open “httpd-vhosts.conf” file. And copy the below lines of code.
<VirtualHost *>
# set path on your project folder
DocumentRoot "C:/xampp/htdocs/_projects/projectname"
ServerName projectname.local
DirectoryIndex index.php
<Directory "C:/xampp/htdocs/_projects/projectname">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
Open C:\Windows\System32\drivers\etc\hosts Add the below line at the end of file.
127.0.0.1 <SERVER_NAME like local.pos.com>
Restart apache server and visit the site URL. That’s all is needed to set up a virtual host.