Apache - How to deny directory but allow one file in that directory
In Apache 2.4, with an additional test on an environment variable for good measure:
See also: Require Directive
<Directory "/wikis/foswiki"> Require all denied # Allow access to toplevel files ending in .html (in particular index.html) only # (comment out if you don't care for this) <Files ~ "\.html$"> <RequireAll> Require all granted Require not env blockAccess </RequireAll> </Files></Directory>