FAQ: How to disable directory browsing in apache/httpd?

Question: How can I disable building of directory index in apache/httpd? In other words, how to prevent users from seeing the contents of published directories?

apache directory index

Answer: Actually you are totally right that you wish to disable this feature. One of the “must do’s” on setting a secure apache web server is to disable directory browsing. Usually apache comes with this feature enabled but its always a good idea to get it disabled unless you really need it.

First of all find where is the main apache’s config file httpd.conf is located. If you use Debian, it should be here: /etc/apache/httpd.conf. Using some file editor like Vim or Nano open this file and find the line that looks as follows:

Options Includes Indexes FollowSymLinks MultiViews

then remove word Indexes and save the file. The line should look like this one:

Options Includes FollowSymLinks MultiViews

After it is done, restart apache (e.g. /etc/init.d/apache restart in Debian). That’s it! 🙂

SHARE:
nv-author-image

Stefan Durand

My name is Stefan, I'm the admin of LinuxScrew. I am a full-time Linux/Unix sysadmin, a hobby Python programmer, and a part-time blogger. I post useful guides, tips, and tutorials on common Linux and Programming issues. Feel free to reach out in the comment section.

2 thoughts on “FAQ: How to disable directory browsing in apache/httpd?”

  1. Thanks for info dude.
    BTW we don’t need to remove Indexes from configuration file.
    Just simply -Indexes

    and save+restart Apache.Voila)

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *