允许从本地主机 .htaccess 列出目录
我的本地网络服务器上有一个文件目录,我想让它只有本地用户才能查看目录列表。例如,如果朋友从他家访问该网站,他应该无法看到 site.com/files/,但可以获取文件 site.com/files/image.png。对于本地用户,我希望他们能够做到这两点。我尝试了以下代码,但它不起作用。有什么想法吗?
SetEnvIf REMOTE_ADDR 192.168.1.* local
<IfDefine local>
Options +Indexes
</IfDefine>
<IfDefine !local>
Options -Indexes
</IfDefine>
Allow from ALL
Deny from NONE
i have a files directory on my local web server and i want to make it so that only local users can view the directory list. for example if a friend visits the site from his house, he should not be able to see site.com/files/ but can get the file site.com/files/image.png. for local users i want them to be able to do both. i tried the following code but it does not work. any ideas?
SetEnvIf REMOTE_ADDR 192.168.1.* local
<IfDefine local>
Options +Indexes
</IfDefine>
<IfDefine !local>
Options -Indexes
</IfDefine>
Allow from ALL
Deny from NONE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用以下内容创建 .htaccess 并将其放置在 /files/ 中。
Create .htaccess with the following and place it in /files/.