Apache – Deny Access to All Files Except index.html

.htaccessapache-2.2

Could someone help me with apache .htaccess file to deny access to all files and sub directories except for index.html on the documentroot for an apache server?

I tried:

<Location />
    Order deny,allow
    <Files index.html>
        Order allow,deny
    </Files>
</Location>

but that didn't work.

Best Answer

Try this:

Order allow,deny
Deny from all
<FilesMatch index\.html>
        Allow from all
</FilesMatch>