Forum Moderators: phranque

Message Too Old, No Replies

<filesmatch ...>deny from all - why does it disable direcory indexing

i've pindowned it now on this

         

hakre

4:54 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi folks,

i'm running into serious trouble with a current apache config via .htaccess.

i just wanted to enable direcotry indexing via

Options +Indexes

which did the job like intended.

then i wanted to block specific filetypes. i choosed the <filematch> directive and putted it into my .htaccess file right after Options:

Options +Indexes
<FilesMatch "\.(gif¦jp?g)$">
Deny from all
</FilesMatch>

the strange thing is: if the deny from all line is not commented out, i can't access .gif and .jpg files but can access .txt file for example but there is no directory listing anymore.

if i just comment the deny line out, directory indexing works fine again.

i don't get it why it is acting like that. are there any ideas?

i hope everyone had a good start this year!
-hakre

jdMorgan

6:22 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hakre,

Just a guess, but you may need to specify an Order for mod_access. That may not fix the problem, but might make it clearer. Note that Order really means "priority", and has nothing to do with whether your Allows or Denies are listed first in your file.

Remember that Apache may not process code in the order that you write it in your file - it often does strange things.

Jim

hakre

6:41 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



thanks for your tips jim. i figured something out which is really interesting:

i blocked files by type, for example

.html
and
.php
. and that's why. internally apache tried the first 3 entries of the
DirectoryIndex
directive which were index.html, index.htm and index.php. all these were blocked and apache quitted to look further.

a local setting of

DirectoryIndex [b]./.[/b]
solved that but i think this is nothing i will use. anyways this one is funny too:
DirectoryIndex [b]./../.[/b]
. drop it into a .htacces and a subdirectory and switch directory indexing on. ;)

for

order
: if you don't use it, it has the default value.

thanks again,
-hakre