我是php的新手,我想限制用户访问文件夹。用户不能访问我的图像文件夹,我在该图像文件夹中有一个拇指文件夹,我该怎么办。
示例:-我有一个文件夹_cat-img,其中我还有一个名为thumb的文件夹我想限制两个文件夹的用户我尝试将代码与.htaccess一起使用,但它不起作用。我在htaccess 中使用这个
**Deny from All**
但它是限制所有文件夹我应该做什么来限制用户访问特定文件夹任何人都可以帮助我这个
使用Directory
apache指令指定特定目录。然后在里面给出访问指令(允许或拒绝)
<Directory "fullpath/_cat_img">
Order Deny,allow
Deny from all
</Directory>
<Directory "full_path/thumb">
Order Deny,allow
Deny from all
</Directory>
编辑
要激活.htaccess,请编辑您的apacheconf,并在网站的虚拟主机部分中添加这些内容。
<Directory documnet_root>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
重新启动apache。