I made 2 virtualhosts in XAMPP Apache environment in in httpd.conf Only first one works. Second one resolves to first entry.
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\shop1"
ServerName shop1
ServerAlias shop1
DirectoryIndex index.php index.html index.htm not-a-file
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
ServerAlias localhost
DirectoryIndex index.php index.html index.htm not-a-file
</VirtualHost>
If I switch entries I get same results only other site is shown. In hosts table, I have both
127.0.0.1 localhost 127.0.0.1 shop1
Each time, I change httpd.conf, I restart apache server. Cleared browser cache each time.
Host
header field. It’s probably not just “shop1”. An easy way to check this would be your browser’s integrated debugging tool or an external program like Fiddler.