Limit Access to a Public File [htaccess]

Using an .htaccess file, add the following (this of course, assumes you have the appropriate server stuff):

Secure specific file:

<Files .htaccess>
     order allow,deny
     deny from all
</Files>

another way to deny by name:

<Files ~ "^\.htaccess">
     Order allow,deny
     Deny from all
</Files>

Deny several files by extension

<Files ~ "\.inc$">
     Order allow,deny
     Deny from all
</Files>

Leave a Reply

Your email address will not be published. Required fields are marked *