I've just set up a new apache 2 install and I'm adding my first virtualhost. I'm seeing some odd behaviour. The virtualhost seems to work, in that if I browse to a URL under the root of my virtualhost in a web browser I get what I expect to see, however if I just go to www.$myhost.com, I get the default apache "It works!" page, which is ironic, because that's exactly what's not happening. If I do www.$myhost.com/index.html, I get the correct page. My DirectoryIndex is set correctly for the virtualhost, and even if it wasn't, the default in mods-enabled is set up to use index.html before anything else. Why is it dropping through to the index.html in the root folder? Why does it pick up the right file when I specifically ask for it, but not when I allow the server to pick the index file? I've googled, but I can't seem to find anyone with the same problem I'm having.

Any help greatly appreciated.


Have you refreshed your browsers cache?

| improve this answer | |
  • Marked as the right answer as I can only assume that's what happened. It's all working now, and I've changed nothing whatsoever. Thanks. Feel a complete n00b now, but at least it works! – user9417 Jun 14 '09 at 21:16
  • I used to look after a bunch of apache servers and I developed refresh-tourets after running around in circles trying to work out what was wrong only to find out my browser was playing silly buggers. :) – Neobyte Jun 17 '09 at 15:05
  • I had the same problem (using Chrome). Note that doing Ctrl-F5 was not sufficient: I had to go in and delete the cache from the settings, and then it worked. – swref Sep 8 '13 at 21:07

If you're accessing your virtualhost with any name different of what you specified in the virtualhost's ServerName, you might be accesing some other unintended virtualhost.

Please provide a copy of your apache config files and the output of apache2 -D DUMP_VHOSTS

| improve this answer | |
  • 1
    I've just checked it this evening, and despite not having changed a single thing, it's suddenly working fine. I guess it must have been cached, though I'm not sure how, as I only tried to visit the site after putting the correct (current, working) config in place. Anyway, thanks for listening to me talk rubbish. I'm off to boil my head. – user9417 Jun 14 '09 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.