Apache deny access to images folder, but still able to display via <img> on site

Posted by jeffery_the_wind on Server Fault See other posts from Server Fault or by jeffery_the_wind
Published on 2012-09-10T14:18:00Z Indexed on 2012/09/10 15:40 UTC
Read the original article Hit count: 195

I have an images folder on my site, let's call it /images/ where I keep a lot of images. I don't want anyone to have direct access to the images via the web, so I put a new directive in my Apache config that achieves this:

<Directory "/var/www/images/">
    Options Includes
    AllowOverride All
    Order allow,deny
    Deny from All
</Directory>

This is working, but it is blocking out ALL ACCESS, and I can't show the images anymore through my web pages. I guess this makes sense. So how do I selectively control access to these images?

Basically I only want to display certain images through certain webpages and to certain users. What is best way to do this? Do I need to save the images to the database?

Tim

© Server Fault or respective owner

Related posts about apache2

Related posts about security