I need to block access to a particular file (containing private data) in a directory using .htaccess. Is this possible?
We use Apache and nginx.
if you want to prevent viewing of a specific file, for example picture.jpg:
<files picture.jpg>
order allow,deny
deny from all
</files>
change picture.jpg with your file.
If you want to deny access to all files with .jpg extension:
<files ~ "\.jpg$">
Order allow,deny
Deny from all
</files>
<Files "yourfile">
Order allow,deny
Deny from all
Satisfy all
</Files>
See apache docs for more info...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.