Prevent access to a file or directory with Apache .htaccess file

Home » Apache » Prevent access to a file or directory with Apache .htaccess file
Date: 2005-08-24
Link: http://apache.devquickref.com/apache-prevent-access-file-directory-allow-deny-grant-access.html

Prevent access to a file or directory with Apache .htaccess file

 
1st approach
create an ".htaccess" file with:
deny from all
2nd approach
create any file that starts with ".ht" and these files will be rejected by the following rule in httpd.conf
<Files ~ "^.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>