[Gllug] Apache - deny image access
Jason Clifford
jason at ukpost.com
Fri Jul 4 08:38:37 UTC 2003
On Thu, 3 Jul 2003, leigh wrote:
> I'm putting together an online photo gallery which uses a php script to
> pull images from a directory (images). But I can't seem to find a way
> to restrict users from directly gaining access to the directory's
> contents thus:
> foobar.com/images/photo1.jpg.
This is fairly simple. Add something like the following to your apache
configuration (or a .htaccess file containing it in the directory):
<FilesMatch "/images/\.(gif|jpe?g|png)$">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
This will prevent any direct access to any GIF, JPEG or PNG file in the
images directory on the site - ie calling them by URL as you describe.
You will still be able to read those files from your PHP scripts and
display them via the script though.
Jason Clifford
--
UKFSN.ORG Finance Free Software while you surf the 'net
http://www.ukfsn.org/ ADSL Broadband available now
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list