Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save apphp/d5460584ee57af33510f7dfcfed44838 to your computer and use it in GitHub Desktop.
Save apphp/d5460584ee57af33510f7dfcfed44838 to your computer and use it in GitHub Desktop.
Prevent Access to a Specific File/s in .htaccess
# source: http://www.apphp.com/index.php?snippet=htaccess-prevent-access-to-single-file-or-multiple-files
# Prevent viewing of a specific file
<files file.jpg>
Order allow,deny
Deny from all
</files>
# Prevent access to multiple file types
<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd)$">
Order Allow,Deny
Deny from all
</FilesMatch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment