I need to configure my Apache2 server (version 2.2.22) such that I allow auto-indexing of the WWW root folder and its sub-directories, but restrict access (i.e. restrict download) to just a set of specific file types (i.e. .txt and .log). In other words, anybody can see what files are present, but only certain file types can be downloaded.
I have come up with the following which does restrict download to just the specified file types, but all URLs for a directory index return 403 Forbidden.
<Directory /var/www/>
Options Indexes FollowSymLinks
SetOutputFilter DEFLATE
AllowOverride None
Order allow,deny
<FilesMatch "">
Order deny,allow
allow from all
</FilesMatch>
<FilesMatch ".+\.(?!(txt|log)$)[^\.]+?$">
Order allow,deny
deny from all
</FilesMatch>
</Directory>