开发者

What are the downside of not having an index.html file to some directories

开发者 https://www.devze.com 2023-01-01 11:21 出处:网络
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 directo开发者_如何学Pythonry, files inside

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 directo开发者_如何学Pythonry, 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!


This depends on your web server, but there are two disadvantages to not having one.

  1. If not secured, some web servers will show the directory contents if there is no default page.
  2. If someone types your_site/directory/, and there is no default page, they will receive a 404 error.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号