File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes How to avoid directory listing? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to avoid directory listing?" Watch "How to avoid directory listing?" New topic

How to avoid directory listing?

Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
If the users types in an url for a directory ( like ) tomcat displays the directory listing.

How can I deny permission for the users to see the directory listing. Is it possible to control it in the server.xml?
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
It is done in the web.xml. Go to conf/web.xml in your tomcat install. Looke for the following code and replace true for false

As shown below

Jason Moors
Ranch Hand

Joined: Dec 04, 2001
Posts: 188
You need to change the Default servlet listing parameter in $CATALINA_HOME/conf/web.xml

Jeppe Sommer
Ranch Hand

Joined: Jan 07, 2004
Posts: 270
Thank you. That works :-)
I agree. Here's the link:
subject: How to avoid directory listing?
Similar Threads
Web Application Manager authorization problem
mapping default page to domain name in tomcat without port Ubuntu
Absolute path for jsp
redirect to /folder with domain name.
Turn off directory listings