Hide file and directory in apache disabling browsing
Posted by Matteo Mattei ~ 14th May 2008
Today I’m happened to disable file and directory browsing on my web server that after my work showed all its content. Shortly, 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…
- httpd.conf / virtual-host
Edit your virtualhost adding these rows:<Directory "/home/httpd/html/mydomain/files"> Options -Indexes </Directory>
- .htaccess
Add in the .htaccess file this row:Options -Indexes
In the first case you need to restart apache server.
My partner and I really enjoyed reading this blog post, I was just itching to know do you trade featured posts? I am always trying to find someone to make trades with and merely thought I would ask.