tags:

views:

148

answers:

1

Hi,

I have an apache webserver serving 2 URLs. I use VirtualHosts to configure it so that the 2 URLs return different pages (one has docRoot = /www, the other has docRoot = /www/tutorials). The problem is that for a subfolder in the tutorials directory (say /www/tutorials/abc) which contains an index.html, using one URL displays the page as is, whereas the other URL shows the folder contents and does not display the index.html file. Clicking on the index.html works though. Any idea how I can get the index.html file to display automatically (as it should!).

Thanks, Gaurav

+2  A: 

You need to add a DirectoryIndex directive to your apache configuration file (such as httpd.conf) for the section where you define your virtual host.

DirectoryIndex index.html
Matt
Thanks for your answer. I now see the problem. I use DirectoryIndex xyz.html since for the 2nd URL I want xyz.html to be displayed. However, for all subfolders I want the DirectoryIndex to be index.html. Any way I can do this?
gveda
I'm not sure about different DirectoryIndex files for subdirectories - but you can specify multiple files in the DirectoryIndex, using spaces as delimeters: "DirectoryIndex xyz.html index.html". I don't think Apache gaurantees to check in that order, but if you don't have index.html it wont be a problem.
Matt
That works. Thanks a lot for your super-helpful answers!
gveda