Httpd – Why do people put empty index.html files into web directories

apache-2.2httpd

I see that quite often other people's web-site directories have empty
html index files (1 file per dir). AFAIK – that's been done to prevent website users from seeing directory content – right?

I usually disable indexing in httpd.conf differently:

<Directory />
   Order Deny,Allow
   Deny from all
   Options None
   AllowOverride None
</Directory>

What would be the reason to create index.html in every web faced directory instead of simply restricting indexing in apache config file?

Best Answer

  1. Httpd config is not always done by the same people as those who write the code / package the web site data. Putting empty index.html is one way to make sure the index is not displayed even if the config is incorrect.

  2. Additionally, it avoids displaying a "forbidden" error message should a user reach the index page, either through manually editing the URL or a broken link. This can be avoided, but it requires some config works, and that's a problem because ... see point 1.

Related Topic