如何在 htaccess 中设置我自己的目录索引规则以允许/阻止特殊文件夹访问?
想象一下,我有一个文件夹,里面有一堆我最近访问裸体殖民地营地的照片,还有里面的华丽照片等等,我不希望每个人在输入主文件夹时都可以访问,例如 www .website.org/photos/
而那些拥有整个文件直接链接的人可以访问:www.website.org/photos/my_first_nude_colony_camp_visit_00281.jpg
现在,是否有可能(如果是的话,正确的 apache 语言是什么)使用 htaccess 或其他神奇力量为我的网站制定以下规则:
规则 1:默认情况下,阻止对任何及所有文件夹内容访问 ftp-lookalike-free-file 列表。
规则2:但是,当该文件夹中存在名为 pass.port 的(隐藏?)文件时,请允许以类似于 ftp 的方式免费列出所有内容。
这样我就可以例外地让哪些文件夹可见,哪些文件夹最好不可见。感谢您的线索和建议!
Imagine I have a folder, inside it are a bunch of photos from my latest nude colony camp visit, and the extravagant shots in it and all, that I dont want just everyone to have access to when typing the main folder e.g. www.website.org/photos/
While those who have direct link of the entire file, can have access:www.website.org/photos/my_first_nude_colony_camp_visit_00281.jpg
Now, is there any possibility, and if yes, whats the proper correct apache language, to have the following rules for my website using htaccess or other magical powers:
RULE1: By default, block access to the ftp-lookalike-free-file listings to any and all folder contents.
RULE2: When however a (hidden?) file named pass.port is present in that folder, then do allow ftp-lookalike free listing of all the contents.
That way I can make exception to which folders I want to let BE visible, and which better NOT. Thank you for your clues and suggestions!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要禁用目录和所有子目录的文件列表,请添加到 .htaccess
要禁用查看具有特定扩展名(例如 .port)的文件,请添加
To disable files listing for the directory and all sub-directories add to your .htaccess
To disable viewing files with a particular extension (for example, .port) add