• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to prevent to see the directory structure in the browser?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I type in http://localhost:8080/examples/jsp/myjsp/
on the browser and if "myjsp" directory contains subfolders and files, it's shown on the browser. How do we prevent them not to appear on the browser? Are there any settings on web.xml file?
Does it vary for different App servers?
Thanks in advance.
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some of the web browsers have settings which do not allow users to see the folders in a directory if there is no index file.
One quick and fast solution (if you don't have access to the web browser directly), is to throw in index.jsp (if it's JSP pages) or index.html documents into those folders (Blank pages of course) and it should take care of this.
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or turn off the DIR's read attribute (r) for group and others and leave execute (x).
Then you will get "FORBIDDEN" instead.
 
Alam Vin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I turned off the Read Attribute by right clicking on the folder and setting the attributes in the properties. But still I am able to see the directory structure. Am I missing something somewhere?
 
Ranch Hand
Posts: 388
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you dont get to the solution using server configuration files, then you can create an empty file named index.html (or index.htm or start.htm, depending on your server settings) and put it in the directory where you want to prevent listings. you could also write some message in this file like "your not allowed to list the content of this directory".
in apache there is a entry in httpd.conf to prevent directory listings, perhaps there is also one on apache.

karl
 
reply
    Bookmark Topic Watch Topic
  • New Topic