OK, I'm in trouble... and it keeps getting worse and worse!

I'm on Windows 7, running XAMPP. I had defined scads of subdomains on localhost for different web projects; i.e. xyz.localhost, abc.localhost, etc. They were working fine. I add each subdomain in two steps:

  1. I add a section to httpd-vhosts.conf that looks like this:

    <VirtualHost *>
        DocumentRoot "path/to/xampp/htdocs/xyz"
        ServerName xyz.localhost
  2. I add an entry to my hosts file (C:\Windows\System32\drivers\etc\hosts) that looks like this: xyz.localhost

Then I restart Apache. Bam. This has always worked and I haven't had to understand the deep inner workings of these files.

I turned on the computer today to find that all my localhost subdomains are suddenly not working. Chrome and Firefox both say they cannot find them. However, I could still access http://localhost, and I could also access the subdomain folders by using

After a little digging, I found this cryptic error in my error log:

VirtualHost _default_:443 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results

So I grepped through files and found out that httpd-ssl.conf has a section that starts with <VirtualHost _default_:443>. However, that file has not been modified in years, so that's probably not the issue.

I tried changing my httpd-vhosts.conf file:

  • from NameVirtualHost * to NameVirtualHost *:80, and
  • <VirtualHost *> to <VirtualHost *:80>

but that didn't work.

So randomly I thought, maybe I'd add a Listen 443 to httpd.conf. That made it so Apache wouldn't start anymore, so I took it out.

What's going on?? What could have changed? I should hasten to add that I don't even know what relevance port 443 has to XAMPP. I don't ever access any of my local sites using SSL, and I don't need it. Can anyone help me? I'm poking around in the dark.

  • 443 is the default port for https (SSL). Have you tried commenting out your httpd-ssl.conf file for testing? If you dont use ssl, you can keep it commented out (unless server available beyond your lan)
    – Wayne
    Mar 17, 2014 at 23:05
  • I did try that. Same problem... not able to access the subdomains (although without the warning about mixing ports). Mar 17, 2014 at 23:12
  • Looking back through the error log, that error has been appearing for a very long time, much longer than the subdomains have not been working. So that's not it. Mar 17, 2014 at 23:25
  • Ok, I just downloaded v1.8.3-3 and this is working. Edited httpd-vhosts.conf. Uncommented NameVirtualHost *:80 and added 4 virtual host settings, 3 setup with servernames site1.localhost, site2.localhost and site3.localhost, one with servername localhost. No other modifications were made to xampp. Edited windows hosts file and all sites working as expected (even xampp control)
    – Wayne
    Mar 17, 2014 at 23:39

2 Answers 2


For those who don't want to bother with the wild goose chase of this thread, let me sum up the problem and its solution. :)

I suddenly was unable to access any subdomains I'd created on localhost using XAMPP. I knew they were set up correctly because they'd worked for a long time prior to the problem.

The problem ended up being my hosts file (C:\Windows\System32\drivers\etc\hosts). This file is for manually entering IP address/hostname pairs, bypassing the DNS server, and it must be edited when adding a subdomain to localhost (see my question for how to do that). The hosts file is pretty picky about how it's formatted, and I realized that something had changed the line endings in that file from CRLF (standard Windows) to CRCR. I had noticed visually that the file appeared double-spaced, but I didn't pick up on the reason until I looked at the hex and saw 0d0d all over the place. I was able to fix the line endings in Sublime Text and everything was happy again.

I suspect that the file was botched by the Cisco AnyConnect Secure Mobility Client. This is the latest iteration of Cisco's AnyConnect VPN client that I recently installed to access a client's VPN. I noticed a new line in my hosts file that specified the IP of that VPN, and I think when the Cisco application added that line, it mangled the line endings of the whole file. My theory.

Thanks, Wayne, for your help in chasing down the problem.


As per my commments above.

  1. Downloaded xampp v1.8.3-3 and installed into C:\XAMPP
  2. Created 3 folders in C:\XAMPP\htdocs\xampp (site1, site2, site3).
  3. Created dummy index.htm file in all three folders just with a title of the site
  4. Edited C:\XAMPP\Apache\conf\extra\httpd-vhosts.conf and made as such

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/xampp"
ServerName localhost

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/xampp/site1"
ServerName site1.localhost

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/xampp/site2"
ServerName site2.localhost

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/xampp/site3"
ServerName site3.localhost

  1. Started command prompt as administrator
  2. Edited hosts via: notepad c:\windows\system32\drivers\etc\hosts
  3. Added the following lines site1.localhost site2.localhost site3.localhost

  1. Started apache via XAMPP control panel
  2. Verfied all 4 sites working: site1.localhost, site2.localhost, site3.localhost and just plain localhost (xampp greeting page)

To diagnose virtual host issues

  1. Check the apache log file
  2. Try pinging the site and ensuring the correct IP address is returned. If ping fails it is usually a DNS/Host file entry issue
  3. Use something like http watch to verify the http header Host xxxx.xxxx is being set for the site
  • Yes, that usually does it for me too! But not since 8:00 this morning. Is there anything else I can check? Mar 17, 2014 at 23:55
  • Try a different browser. What should happen is the browser sends the host headers, apache interrogates those headers to display the correct site. If the headers are not formed correctly, this could be an issue. Does ping xyz.localhost work? I would assume so otherwise you would get a server not found error
    – Wayne
    Mar 18, 2014 at 0:02
  • Other browsers don't work, and ping doesn't work. Could not find host. Mar 18, 2014 at 0:03
  • great! check your hosts file. Sounds like not working properly
    – Wayne
    Mar 18, 2014 at 0:04
  • You want to know what it was? Line endings in the hosts file! They have to be CRLF (Windows style); mine somehow got changed to CR only. I think it's the fault of Cisco AnyConnect Secure Mobility Client. I recently installed it to access a VPN and it added a line to the hosts file, probably botching it in the process. Maybe I should let them know about this. Mar 18, 2014 at 0:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .