Re: Disabled directory listing, but I got 404 instead of 403

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On November 16, 2011 14:02 , Torok Peter <netmano88@xxxxxxxxx> wrote:
I tried to turn off, but when mod_dir is not loaded, I got a 404 error for an url www.somesite.com/dirsite <http://www.somesite.com/dirsite> where /dirsite/index.php does exist.

This is expected: mod_dir, via the DirectoryIndex directive, is what looks for the "index.php" resource when the user requests directories. If you need this functionality, then you have to keep mod_dir enabled. If you have mod_dir enabled, then if a user requests a directory, and autoindexing is turned off, then mod_dir will look for an index file, and the correct response when the index file is not found is "404 Not Found", not "403 Forbidden".

If you really need these requests to result in a 403, you could try using mod_rewrite: "if the directory exists, and no index file exists, return '403 Forbidden'". (Note that I have not tested this, I don't know if it will work)

RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME/index.php !-f
RewriteRule ^. - [F]


--
  Mark Montague
  mark@xxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux