How to setup a virtual host in windows with XAMPP Server

How to setup a virtual host in windows with XAMPP Server

A very easy step you need to follow if you would like to set up virtual domain if you are using xampp.

Step 1:-
Make sure xampp is installed
Step 2:-
Go to

C:\xampp\apache\conf\extra

This is my path Go to C:\worldgyan\apache\conf\extra(depends on where xampp is installed)
Step 3:-
Search file name httpd-vhosts.conf
so now the path is Go to

C:\xampp\apache\conf\extra/httpd-vhosts.conf

Step 4:-
In httpd-vhosts.conf copy following code

                ServerAdmin [email protected]
                DocumentRoot "C:/worldgyan/htdocs"
                ServerName dev.worldgyan.com
                #ErrorLog "logs/dev.worldgyan.com-error.log"
                #CustomLog "logs/dev.worldgyan.com-access.log"

example:-

Step 5:-
Replace above "dev.worldgyan.com" to your domain
Step 6:-
At xampp level every thing fine
Now go to


               C:\Windows\System32\drivers\etc

Please see the below image for more details

Step 7 :-
search filename
hosts and edit at last


               127.0.0.1       dev.worldgyan.com

Make sure to replace "dev.worldgyan.com" to your domain

Now restart apache and try to serve the domain  through the browser

That's it now enjoy ;)


I hope you like this post