SunQuest
           Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 12th, 2001, 05:21 PM
Quasimodem Quasimodem is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 1 Quasimodem User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Red face

Just looking for a quick answer to a quick question-

I'm looking to prevent people form browsing my images folder but still be able to access those images elsewhere in my site with normal <img> tags etc...
I looked around a bit on the forum and found some stuff about just making a .htaccess file with

Options -Indexes

in it, so I did that, but it cuts off ALL access, even to other parts of my site, like my <img> tags.
Am I on the right track? What exactly does my .htaccess file need to look like? Right now it's JUST
Options -Indexes, but do I need some

<Directory /home/public_html/images/>
Options -options
</Directory>

too or something?

Thanks for any help you can offer

-Quasimodem

Reply With Quote
  #2  
Old March 13th, 2001, 10:23 AM
tlthomas tlthomas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Idaho
Posts: 46 tlthomas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to tlthomas
Just add a index.html into your images directory and that will come up instead of the directory listing.
terry
__________________
It works better if you plug it in!

Reply With Quote
  #3  
Old March 13th, 2001, 06:50 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> so I did that, but it cuts off ALL access

That's because Indexes is not allowed to be overridden.

Start here -> http://httpd.apache.org/docs/mod/co...l#allowoverride

Specifically, you need to have AllowOverride Indexes so your -Indexes in .htaccess can override the globally enabled Indexes.

Reply With Quote
  #4  
Old March 13th, 2001, 08:16 PM
tlthomas tlthomas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Idaho
Posts: 46 tlthomas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to tlthomas
question freebsd???
since i'm a novice at some of this why would you want to be changing/adding the httpd.conf file to accomodate the rather basic needs of of preventing the access to a default directory listing when just adding an index.html to that directory would prevent the listing of its contents? i've always added an index.html to my directories just for that reason???
just curious...
terry

i should note that my index.html for those directories include a redirect...
<html>
<head>
<meta http-equiv="REFRESH" content="01; url=back.to.homepage.html">
<title>Redirect</title>
</head>
<body>
</body>
</html>


[Edited by tlthomas on 03-13-2001 at 07:25 PM]

Reply With Quote
  #5  
Old March 13th, 2001, 08:44 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> why would you want to be changing/adding the httpd.conf file

Simply because of speed, bandwidth and resource. Telling Apache to load index.html requires additional resource. Apache has the exact directive for that purpose, so why tell Apache to do unnecessary works? Right, your site might not get that many hits and the difference might not be significant but that's just the correct way to configure Apache.

Reply With Quote
  #6  
Old March 13th, 2001, 09:08 PM
tlthomas tlthomas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Idaho
Posts: 46 tlthomas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to tlthomas
>Simply because of speed, bandwidth and resource
i see your point there, but i'm hosting 6 domains and not everyone (70%) are barely capable of doing updates on their sites much less creating .htaccess files, is the AllowOverride Indexes something that should be implemented as a default (in your opinion) or is it to be used as a last resort??? or am i better off just continuing to tell them to put a blank index.html file in /images , etc directories???
trying to learn here... patience please!!!
terry

Reply With Quote
  #7  
Old March 13th, 2001, 09:32 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> is the AllowOverride Indexes something that should be implemented as a default (in your opinion)

Yes.

>> or am i better off just continuing to tell them to put a blank index.html file in /images , etc directories???

No. Tell them to put Options -Indexes in their .htaccess and upload it to whatever dirs they don't want to be browsable and you are saving yourself some bandwidth and resource.

Reply With Quote
  #8  
Old March 14th, 2001, 12:03 AM
tlthomas tlthomas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Idaho
Posts: 46 tlthomas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to tlthomas
what i don't comprehend/understand is that my isp does not have that directive in their .conf file and they are hosting 1000's of sites???
why, (this is a bad question,) should i have to put up a tutorial to teach them (my domains)something that they don't want to learn????
i would love it if everyone was able to learn the basic capabilities of apache... but i can't go there...
?????
terry

Reply With Quote
  #9  
Old March 14th, 2001, 12:27 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Probably for security reasons.

Tell them to go -> http://httpd.apache.org/docs/mod/co...l#allowoverride

and tell them, AllowOverride Indexes is the least insecure one followed by FileInfo, Options, Limit and AuthConfig.

Reply With Quote
  #10  
Old March 15th, 2001, 03:30 PM
Pharkas Pharkas is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Location: Manchester
Posts: 16 Pharkas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
back to the point

as far as I know, none of the above actually helps with the original question. There's no standard way to have JPG's usable on a webpage without having them accessible via:

http://www.yoursite.com/thepic.jpg

Three ways I can think to achieve what you want:

1) Do some jiggerypokery with the GD graphics library. You could keep all your JPG's in a private (totally protected using .htaccess or above the web root) directory, then generate an on-the-fly graphic from this stored one using the GD library.

2) Store all the images in binary in a mySQL database and retrieve them from there with PHP

3) Encrypt the JPG's in some way and make a decrypt PHP script.

4) Put the images in a .htaccess protected directory then use the HTTP Get within PHP to make a mini-robot/browser type thing that retrieves the image.

There are pretty much in order of sensible-ness. BUT there still seems little point in doing any of them, because although they will prevent URL access to the images, they don't stop a user right-clicking on the image on the webpage and saving it from there. And if you think you can get around this latter problem using snide javascript that detects right-clicks etc, don't bother - I've seen many and not a single one stops a user with a clue!

Anyway, at least that answers your direct question - but I'm not sure it's all that much use to you all the same!

My $0.02.

- Adam
adam@acdinternet.com
http://www.acdinternet.com

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Denying directory browsing


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway