[英]How to deny access to a file using .htaccess?
I need to block access to a particular file (containing private data) in a directory using .htaccess. 我需要使用.htaccess阻止访问目录中的特定文件(包含私有数据)。 Is this possible? 这可能吗?
We use Apache and nginx. 我们使用Apache和nginx。
if you want to prevent viewing of a specific file, for example picture.jpg: 如果要防止查看特定文件,例如picture.jpg:
<files picture.jpg>
order allow,deny
deny from all
</files>
change picture.jpg with your file. 使用文件更改picture.jpg。
If you want to deny access to all files with .jpg extension: 如果要拒绝访问所有扩展名为.jpg的文件,请执行以下操作:
<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... 有关更多信息,请参见apache文档 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.