xampp virtual host - always loading htdocs

For anyone who reads this and no solution help you, this is what helped me.

Just uncomment this Include line in your httpd.conf:

# Virtual hosts
Include etc/extra/httpd-vhosts.conf

That way, it will make changes you made in your etc/extra/httpd-vhosts.conf available!

Don't forget to restart Apache server afterwards!


Here is a guide to add vhost to xampp

Seems that you miss something with the hosts file.

For example, say you had another Web site for ClientB. You’d add 127.0.0.1 clientB.local >in the hosts file and the C:\xampp\apache\conf\extra\httpd-vhosts.conf would look like this:

NameVirtualHost *
  <VirtualHost *>
    DocumentRoot "C:\xampp\htdocs"
    ServerName localhost
  </VirtualHost>
  <VirtualHost *>
    DocumentRoot "C:\Documents and Settings\Me\My Documents\clientA\website"
    ServerName clientA.local
  <Directory "C:\Documents and Settings\Me\My Documents\clientA\website">
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
<VirtualHost *>
    DocumentRoot "C:\Documents and Settings\Me\My Documents\clientB\website"
    ServerName clientB.local
  <Directory "C:\Documents and Settings\Me\My Documents\clientB\website">
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

And restart httpd