View Single Post

  #1 (permalink)  
Old 10-27-2007
Russell Bell
 
Posts: n/a
Default Host with trailing slash

We're hosting a website for customer using named virtual hosting,
which works fine except for one problem. The customer says they
can't access the website home page (www.xxx.co.nz)
from certain PC's. The browser gets a "Directory index forbidden by rule"
error.

If they use a URL of "www.xxx.co.nz/index.htm" it
works fine. But naturally they want the simpler URL to work also.

Going by the access log (below) the problem seems to be that the
http host header has a trailing slash. So Apache thinks it should
do a directory listing, which is forbidden.

Of course I don't want a directory listing, I want Apache to use
DirectoryIndex (index.htm). How can I bend Apache to my will in
this circumstance ?

We're running Apache 2.0.50 on Mandrake. Here's the access.log
and error.log entries (with customer name and IP xxx):


x.x.x.x [23/Oct/2007:13:29:40 +1300] "www.xxx.co.nz/"
398 "GET / HTTP/1.0" Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; .NET CLR 1.1.4322)

[Tue Oct 23 13:29:40 2007] [error] [client x.x.x.x]
Directory index forbidden by rule: /var/www/html/xxx/

The Vhosts.conf entry is:

<VirtualHost *:80>
ServerName xxx.co.nz
ServerAlias xxx.co.nz *.xxx.co.nz xxx.com *.xxx.com
DocumentRoot /var/www/html/xxx
DirectoryIndex /index.htm
</VirtualHost>