This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes how u keep directory browsing off 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 u keep directory browsing off" Watch "how u keep directory browsing off" New topic
Author

how u keep directory browsing off

sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
hi all,

can anybdy pl. tell me how i can switch off the directory browsing on my tomcat 5.5 server.

regards,
sachin.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

I don't know how this "u" guy does it, but I simply put an index.html file in the folder and that prevents any directory from appearing.

Tomcat 5.5 may have added a config entry for this, but I'm pretty sure earlier versions did not have one.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12756
    
    5
The parameter you want is in the web.xml definition of the default servlet - which is what is generating those directory listings. The default web.xml file is in the conf directory.

Just change the param-value associated with the init-param named listings from true to false.

Bill
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

Too cool! I looked everywhere except the default web.xml.
sachin yadav
Ranch Hand

Joined: Nov 24, 2005
Posts: 156
i agree bear that itz risky to play with web.xml but i think this is the best and easiest way to do this.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

Originally posted by sachin yadav:
i agree bear that itz risky to play with web.xml


Not at all. I "play" with web.xml files all the time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how u keep directory browsing off
 
Similar Threads
how to stop server from serving index.jsp?
Turning off directory browsing
Directory Browsing
stopping the application from displaying index.jsp
Select Directory