Empty index.html files for what reason?

This is one somewhat strange question, but I wondered a lot of times about it. As I’m curious and I want to learn something, I’ll dare to ask.

Why are there some empty index.html files in kirby directories, like:


Is this some apache security thing so that the contents of these direcories cannot be seen?

This is indeed a security measure. The index.html file is usually the first file that is called by the server, thus preventing file listing for these folders.

However, the best way to prevent directory listing is to configure your web server appropriately to turn off directory indexing. If you rely solely on this method, it is very easy to forget to add such a file, because you have to add it to every folder that you want to protect.

Are there any ideas on how to achieve this solely with .htaccess? What about:

<IfModule mod_autoindex.c>
    Options -Indexes

I just found this thread and will take a closer look … : )

1 Like