Posted By

apphp-snippets on 10/03/17


file htaccess to access prevent specific

Versions (?)

Prevent Access to a Specific File/s in .htaccess

 / Published in: Bash


This example shows you how to restrict to a specific file or multiple files. Add the following code block and edit the file name/s according to yuor needs.

  1. # Prevent viewing of a specific file
  2. <files file.jpg>
  3. Order allow,deny
  4. Deny from all
  5. </files>
  7. # Prevent access to multiple file types
  8. <FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd)$">
  9. Order Allow,Deny
  10. Deny from all
  11. </FilesMatch>

Report this snippet  

You need to login to post a comment.