Hide file and directory in apache disabling browsing

to prohibit that every users can view the content of a directory (if noindex.php/index.html is present) occur a little modifying to configuration file of apache or a new directive in .htaccess.

I’ll show you how to do in both cases…

  1. httpd.conf / virtual-host

    Edit your virtualhost adding these rows:

    <Directory “/home/httpd/html/mydomain/files”>
    Options -Indexes
    </Directory>

  2. .htaccess

    Add in the .htaccess file this row:

    Options -Indexes

In the first case is necessary to restart apache server.