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

Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.

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! :)

 
 
» You might also be interested in the following articles:
Disable double hyphen to dash wordpress replacements
FAQ: How to disable/remap a keyboard key in Linux?
How to create custom linux ISO image?
TinyFlux 1.0: Minimal Linux Distro
Check how your site looks in Internet Explorer via Firefox etc.



» Want to stay up to date? Subscribe to our E-MAIL or RSS feed!

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


  1. 1 Lars

    there is a copy-paste mistake, when u say, u\’ll remove, u should remove the word \’Indexes\’ ;)

  2. 2 artiomix

    Thanks Lars ;)

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word




Friendly Sites:Who is behind Linux Screw?
Aspiring Sysadmin | GeekyBits³ | Bash Cures Cancer | TOTMS
Linux Operating System | Small Linux Deployments | My SysAd Blog
The Danesh Project | ZEPY | Linux config Wiki | Planet Sysadmin
The Sys Admin | {buhay sysad} | a non-geek's linux notes
Linux HOWTOs, Tutorials & Projects with Adam Palmer | LinuxAlt.Com
My name is Artem Nosulchik (artiomix AT gmail DOT com) and I'm Linux/Unix, Cisco systems engineer. The main idea of Linux Screw is to share relevant knowledge, skills and observations over The Web. Here you can find a lot of information related to different Linux distributions, FreeBSD, IOS as well as a other Open Source around staff. Read more ››