How to hide folder files in apache

Posted on December 9, 2019

We use public folders in our applications in order to serve easier and faster static files, llike images, css and js. But we may want to hide the listings of these public folders if is not intented to show all the files that exist in the folders.

If you use apache2, a simple way to hide the files of the folders from the public view, is adding this line at .htaccess.

IndexIgnore *

The .htaccess file can be at the root folder,  this command affects the child folders too.