View Full Version : Stop people viewing Index sites
murphyz
05-08-2003, 11:24 PM
It has just come to my attention that one of the places where I store my images and such like allows people to view the contents of the folders in a page stated 'Index of #namehere#'.
Is there a way to stop this happening?
For example (these won't work)
www.murphyz.co.uk/images/me.jpg would show an image of me.
www.murphyz.co.uk/images/ would show the index of the images folder which has all images included.
Is there a way to prevent this?
Thanks in advance?
Mxx
Spookster
05-08-2003, 11:49 PM
You can do this one of a few ways. One way is to use a .htaccess file and put this in there:
Options -Indexes
Another way is to just put a default blank webpage in the directory like index.html or whatever is the default page name for you server setup.
murphyz
05-09-2003, 12:23 AM
duh - sooooo simple.
Yes, index.htm worked fine - thank you.
*goes to bang head off brick wall*
Mxx
Spookster
05-09-2003, 12:26 AM
The main benefit of using the .htaccess file though is obviously you don't have to put the default page in the directory and if you put the .htaccess file in the main root directory it will apply to all subdirectories so if you have more than one directory you need to do this on then just one .htaccess file will take care of it. Or if you have control over the server then you can also do this in the web server configuration file for apache or in IIS there is an option to turn off directory browsing.
And yes sometimes the solutions are just soo simple it's like duh why couldn't I think of that. Happens to me all the time. A professor once always preached to us....if something starts to get complex start thinking in simple terms because the solution is usually something simple.
Hi,
i did that on one of my sites, put an .htaccess file in the root directory, this does disable directoty view, but displays an error 500 message(internal server error) and well it applies to all the directories. Which means that even I cannot view any directory even if it is a hidden directory.
Putting index.html as you said will be time consuming if there are many folders and sub/sub/sybfolders
What would be the way out?
Is it possible to to apply .htaccess to all but one ot two directories
Thanks
RHS
You could speak to your ISP. I hadn't thoguht of this issue until raised here and then tried it on my site. The forbidden page comes up saying I am forbidden from accessing this file ( or words to that effect). I didnt set it up like this - it must have been my ISP.
hth
Just put an .htaccess file in the folders you dont want the indexes to be seen , the others can be left as they are. For example your images folder could contain the .htaccess file - that will thow an error : "forbidden: you donot have permission to access this folder on this server ...etc" instead of putting it in the root directory
:)
RHS
scroots
07-12-2003, 09:08 PM
http://www.javascriptkit.com/howto/htaccess2.shtml specify an error document using htaccess.
scroots
Thanks Scroots,
the link above is very useful , lots of info
RHS
Mhtml
07-14-2003, 03:38 AM
Originally posted by rhs
Thanks Scroots,
the link above is very useful , lots of info
RHS
And thank F (http://www.codingforums.com/member.php?s=&action=getinfo&userid=9) e (http://www.codingforums.com/member.php?s=&action=getinfo&userid=1) y (http://www.codingforums.com/member.php?s=&action=getinfo&userid=5) d (http://www.microsoft.com/billgates/default.asp) !! (http://www.codingforums.com/member.php?s=&action=getinfo&userid=3) :D lol
Click each individual letter!
oracleguy
07-14-2003, 03:43 AM
You forgot jkd. :p
Thanks everyone at codingforums.com
Mhtml
07-14-2003, 06:30 PM
Originally posted by oracleguy
You forgot jkd. :p
Doh! Added exclaimations for him. :D
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.