Prevent Access to a Specific File/s in .htaccess


/ Published in: Bash
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. # Prevent viewing of a specific file
  2. <files file.jpg>
  3. Order allow,deny
  4. Deny from all
  5. </files>
  6.  
  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>

URL: http://www.apphp.com/index.php?snippet=htaccess-prevent-access-to-single-file-or-multiple-files

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.