Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   How to prevent a file listing? (http://www.velocityreviews.com/forums/t162537-how-to-prevent-a-file-listing.html)

paul 08-22-2005 11:15 PM

How to prevent a file listing?
 
Hi,

If I have a website with an 'images' folder then someone can navigate to the
folder with their browser and automatically a file listing appears, how can
I prevent that?

Thanks,

Paul



Mark Parnell 08-22-2005 11:22 PM

Re: How to prevent a file listing?
 
Previously in alt.html, paul <P.Fredlein@NOSPAMuq.net.au> said:

> If I have a website with an 'images' folder then someone can navigate to the
> folder with their browser and automatically a file listing appears, how can
> I prevent that?


In the configuration on the server. If it's Apache, and you don't have
access to the main configuration file (usually httpd.conf), you may be
able to do it in your .htaccess file by adding the following line:

Options -Indexes

--
Mark Parnell
http://www.clarkecomputers.com.au
alt.html FAQ :: http://html-faq.com/

Greg N. 08-22-2005 11:26 PM

Re: How to prevent a file listing?
 
paul wrote:
> automatically a file listing appears, how can
> I prevent that?


Put a file named index.html in there.


--
Gregor's Motorradreisen:
http://hothaus.de/greg-tour/

CptDondo 08-23-2005 03:19 AM

Re: How to prevent a file listing?
 
paul wrote:
> Hi,
>
> If I have a website with an 'images' folder then someone can navigate to the
> folder with their browser and automatically a file listing appears, how can
> I prevent that?


You can also allow only browsers that identify themselves as being
referred by your site. if you run apache, put something like this in
the .htaccess file in the images directory. Note that this kind of
security is easily circumvented; it will prevent a casual browser from
accessing images but the referer is easily forged by anyone who is
determined....

This will also break some browsers. I've also found that the -Indexes
option breaks IE for some weird reason.... So I had to turn in back on....

Options +FollowSymlinks
Options +SymlinksIfOwnerMatch
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.xxxxxxx.com/.*$ [NC]
RewriteRule .*\.(jpg)$ - [F,L]
Options +Indexes

Toby Inkster 08-23-2005 07:41 AM

Re: How to prevent a file listing?
 
CptDondo wrote:

> I've also found that the -Indexes option breaks IE for some weird
> reason....


You must have been mistaken/drunk/stupid that day. Turning off Directory
indexes effects all browsers equally.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact


CptDondo 08-23-2005 12:51 PM

Re: How to prevent a file listing?
 
Toby Inkster wrote:
> CptDondo wrote:
>
>
>>I've also found that the -Indexes option breaks IE for some weird
>>reason....

>
>
> You must have been mistaken/drunk/stupid that day. Turning off Directory
> indexes effects all browsers equally.
>


That's what I would have thought.... But one person with Japanese WinXP
and IE kept getting permission denied errors until I turned it back
on.... Worked fine on my Linux/Firefox workstation.... Maybe I'll do a
bit of testing once I get back on a WinXP box...

dorayme 08-23-2005 02:18 PM

Re: How to prevent a file listing?
 
> From: "Greg N." <yodel_dodel@yahoo.com>
> paul wrote:
>> automatically a file listing appears, how can
>> I prevent that?

>
> Put a file named index.html in there.



What a good idea!


Jonathan N. Little 08-25-2005 03:58 PM

Re: How to prevent a file listing?
 
CptDondo wrote:

> Toby Inkster wrote:
>
>> CptDondo wrote:
>>
>>
>>> I've also found that the -Indexes option breaks IE for some weird
>>> reason....

>>
>>
>>
>> You must have been mistaken/drunk/stupid that day. Turning off Directory
>> indexes effects all browsers equally.
>>

>
> That's what I would have thought.... But one person with Japanese WinXP
> and IE kept getting permission denied errors until I turned it back
> on.... Worked fine on my Linux/Firefox workstation.... Maybe I'll do a
> bit of testing once I get back on a WinXP box...


If indexes are off then they SHOULD get a 403 Forbidden error on any
request to a site's sub directory without either a request explicitly
for an *existing* document in that directory or a default *index*
document. 403 error is generated bay the server, the browser has nothing
to do with it!

If the OP does not have access to the server configuration to turn off
indexes or and .htaccess to do the same then as previously suggested a
very simple solution is to put a index.html file in such folders with
warning message about improper access and a link back to your html
documents....

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Captain Dondo 08-25-2005 04:24 PM

Re: How to prevent a file listing?
 
Jonathan N. Little wrote:

> If indexes are off then they SHOULD get a 403 Forbidden error on any
> request to a site's sub directory without either a request explicitly
> for an *existing* document in that directory or a default *index*
> document. 403 error is generated bay the server, the browser has nothing
> to do with it!
>
> If the OP does not have access to the server configuration to turn off
> indexes or and .htaccess to do the same then as previously suggested a
> very simple solution is to put a index.html file in such folders with
> warning message about improper access and a link back to your html
> documents....
>


Maybe my recollection is wrong... But I remember it was a stumper... I
am using ModRewrite and there may have been some other things in there
that screwed it up...

Jonathan N. Little 08-25-2005 08:52 PM

Re: How to prevent a file listing?
 
Captain Dondo wrote:
<snip>
> Maybe my recollection is wrong... But I remember it was a stumper... I
> am using ModRewrite and there may have been some other things in there
> that screwed it up...


That may be so, but since the this is done at the server-side all
browsers would receive the same error message, unless some conditional
base upon the user-agent...

Still the simplest is on server end turning off indexes: -Indexes in
[directory|virtual host|.htaccess]

or

adding an index.html doc in folders to prevent listing...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


All times are GMT. The time now is 02:53 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57