Search code examples
apache.htaccessfile-type

.htaccess allow one specific file format only in directory listing


I have a directory but only want one file type to be listed.

I've tried the following:

<FilesMatch "\.(?!ext).*$">
  Order Allow,Deny
  Deny from all
</FilesMatch>

However it gives me a 403.

Is there any way to do this?


Solution

  • Check out the IndexIgnore directive

    The IndexIgnore directive adds to the list of files to hide when listing a directory. File is a shell-style wildcard expression or full filename. Multiple IndexIgnore directives add to the list, rather than the replacing the list of ignored files. By default, the list contains . (the current directory).

    IndexIgnore README .htaccess *.bak *~