xampp virtual hosts code example

Example: adding virtual host xampp

Step 1:

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

Step 2:

Create a virtualhost file. Open “httpd-vhosts.conf” file. And copy the below lines of code.



ServerAdmin [email protected]
DocumentRoot 
ServerName 


Replace PATH_TO_PROJECT_DIRECTORY_HERE & SERVER_NAME with appropriate values, Save the file.

Step3:

Open C:\Windows\System32\drivers\etc\hosts

Add the below line at the end of file.

127.0.0.1      

Tags:

Misc Example