某些目录没有 index.html 文件有什么缺点
我很好奇不将 index.html 文件放入目录(例如图像)有哪些影响/缺点。我知道当目录中不存在索引文件时,该目录中的文件不再是私有的,并且在指向时对浏览器可见(例如 yoursite.com/images/)。除此之外,还有哪些重大影响需要考虑?以及如何正确保护它们。
谢谢!
I'm curious what are some effects/downside of not putting an index.html file to your directories (e.g images). I know when an index file is not present to a directory, files inside that directory are no longer private and will be visible to the browsers when point (eg yoursite.com/images/). Aside from that what are some big effects to consider? and how to properly secure them.
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您的网络服务器,但没有网络服务器有两个缺点。
对于当前的 Web 服务器,有很多方法可以避免每个目录都没有默认页面。您可以设置自定义 404 重定向到可用页面,有些页面可以自动为您添加一个页面。就安全性而言,您可以关闭目录浏览以防止人们看到内容。
如果您正在配置自己的服务器,那么没有服务器就不再是一个问题,因为您可以控制服务器如何响应此类情况。人们通常只是将其作为故障保险装置,以确保上述两个问题得到解决。
This depends on your web server, but there are two disadvantages to not having one.
With current web servers, there are many ways to get around not having a default page for each directory. You can set the custom 404 to redirect to a page that is available, and some can put one in automatically for you. As far as security goes, you can just turn off directory browsing to not allow people to see the contents.
If you are configuring your own server, not having one becomes less of an issue since you can control how the server responds to such situations. People normally just put it in as a fail safe, to make sure that the above two problems are taken care of.