How to configure virtual hosts on Apache on Windows

If you are using Apache on your Windows machine and want to set up virtual hosts so you can type something like this “www.myDomain.tst” in your browser and it’ll direct you to your local hosted site … you have to edit this file:

C:\WINDOWS\system32\drivers\etc\hosts

Add a new line with this text
127.0.0.1  myDomain

Open apache\conf\extra\httpd-vhosts.conf file and add these lines:

<VirtualHost *:80>
DocumentRoot path_to_your_document_root
ServerName myDomain
</VirtualHost>

Leave a Reply

Your email address will not be published. Required fields are marked *