Apache Options -Indexes give me 404 instead of 403, why

apache-2.2indexes

I have an Apache/2.2.21 (Debian) webserver, which I disabled directory listing with Options -Indexes but now I got 404 error for a directory, but I think I should get a 403.

I have no idea why I get 404, rather than 403.
What should I check?

I have disabled autoindex module, after it I got a 404 for every URL that request a directory listing (eg: www.somesite.com/dir ). How can I get a 403 for this. (The dir does exist)

As a try I also put Options -Index in the end of main config file (apache2.conf).

Best Answer

I had exactly the same problem and I found that the solution is as simple as:

  1. ENABLE mod_autoindex, otherwise you'll never get 403 for directory requests
  2. DISABLE Indexes in directory's Options setting for obvious reason