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

 

26 Comments

 

  1. June 3, 2008  1:20 pm by Lars Reply

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

  2. April 23, 2011  10:56 pm by the best seo software Reply

    It’s truly a great and helpful piece of info. I’m satisfied that you simply shared this useful info with us. Please stay us up to date like this. Thanks for sharing. Do you know anything about SEO Software?

  3. April 27, 2011  7:42 pm by 4life Reply

    Thanks for the sensible critique. Me and my friend were just preparing to do a little research on this. We got a book from our area library but I think I learned more from this post. I'm very glad to see such wonderful info being shared freely out there...

  4. April 29, 2011  4:54 pm by cheapest car incurance Reply

    Thanx for a very interesting site. What else may I get that type of information written in such a perfect manner? I've a challenge that I am simply now operating on, and I have been at the look out for such info.

  5. May 2, 2011  11:28 pm by constructive dismissal Reply

    I have been absent for some time, but now I remember why I used to love this website. Thank you, I’ll try and check back more often. How often do you update your blog?

  6. May 3, 2011  4:06 pm by achieve anything Reply

    I was just searching for this info for some time. After six hours of continuous Googleing, finally I got it in your website. I wonder what is the Google's issue that doesn't rank this type of informative websites closer to the top. Normally the top web sites are full of garbage.

  7. May 3, 2011  4:09 pm by best self help book Reply

    Hey. Neat article. There is an issue with your website in internet explorer, and you might want to check this... The browser is the marketplace chief and a good portion of folks will omit your great writing due to this problem.

  8. May 4, 2011  1:20 pm by mma workout Reply

    Hello there. I found your web site by means of Google even as looking for a similar topic, your web site came up. It looks good. I have bookmarked it in my google bookmarks to come back later.

  9. May 29, 2012  8:32 am by fahad Reply

    alternatively: sudo a2dismod autoindex

  10. Pingback : How to disable directory listing in Apache « Wahab's Blog

  11. July 15, 2012  3:09 am by Pat Reply

    The above answer by fahad is more effective and useful.

    It's easier to simply disable autoindex if you never plan to use it. Thanks for the tidbit.

  12. October 21, 2012  10:53 am by download linux Reply

    Hello! I simply want to offer you a big thumbs up for the
    great info you've got here on this post. I'll be returning to your website for
    more soon.

  13. November 13, 2012  8:13 pm by DebianRulez Reply

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

    and save+restart Apache.Voila)

    Thanks

  14. Pingback : building a LAMP server on a hosted ubuntu linux (11.04) partition | Meta-Lassi Blog

  15. February 21, 2013  5:09 am by ibrahim Reply

    just 1 word for u
    thumbs up...
    nice sharing
    keep it up

  16. March 22, 2013  9:46 pm by agate cameos pendant Reply

    It's awesome for me to have a site, which is good for my know-how. thanks admin| agate cameos pendant http://www.goldmemoriesforever.com

  17. April 26, 2013  7:38 pm by prom dresses plus size cheap Reply

    At the same time fabulous these eveningwear may appear, your new enthusiasm ways quite possibly the most to you.

  18. May 2, 2013  6:42 am by hugo boss trainers uk outlet Reply

    What are you saying, man? I understand everyones got their own viewpoint, but really? Listen, your blog is cool. I like the effort you put into it, especially with the vids and the pics. But, come on. Theres gotta be a better way to say this, a way that doesnt make it seem like most people here is stupid!

  19. May 6, 2013  8:11 pm by Cyklinowanie Szczecin Reply

    This web site is my aspiration , really fantastic design and perfect articles .

  20. May 11, 2013  4:26 pm by Karl Penigar Reply

    I think other website proprietors should take this website as an model, very clean and magnificent user genial style and design, let alone the content. You're an expert in this topic!

  21. May 13, 2013  11:16 pm by ljetne gume Reply

    Hey very cool web site!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also…I'm happy to find a lot of useful information here in the post, we need develop more strategies in this regard, thanks for sharing. . . . . .

  22. May 14, 2013  4:02 am by WebMarCom Reply

    Hiya, I'm really glad I have found this info. Today bloggers publish only about gossip and net stuff and this is really irritating. A good web site with interesting content, this is what I need. Thank you for making this web-site, and I will be visiting again. Do you do newsletters? I Can't find it.

Leave a reply

 

Your email address will not be published.