Jump to content

Understanding web directories

- - - - -

  • Please log in to reply
2 replies to this topic

#1
fread

fread

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 796 posts
I am building a website and I have everything set up and running on my local computer. I have all of the site contents in one directory, and I put all the subfolders and files inside that director. I realize while browsing the site I can capture the url of my images and other resources and then navigate via the browser to the folder containing that resource; which exposes all other resources in that directory( which can also be done by viewing the source code an looking at the directory paths). For example if I click on a image I can get the image location, paste the location in the url, remove the image name from the url - I can see the directory contents. All of the code is done by hand thus far. I was wondering if there is a way to block viewers from viewing directory contents in this manner.
Perfection of means and confusion of ends seem to characterize our age. Albert Einstein :confused:

#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#
A easy trick is to put an empty index.html in each directory so that shows instead of the directory listing. Another way is to give a directory listing disallowance in the settings in a .htaccess file (if using apache) or similar way
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#3
fread

fread

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 796 posts
Putting the empty html file works. The apache docs are a bit much for a beginner like myself to grasp all at once, so I'm pretty much picking up bits and pieces here and there. I haven't done any type of server configuration as yet; working with the default settings.
Thank you!
Perfection of means and confusion of ends seem to characterize our age. Albert Einstein :confused:




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users