So as I see it, there are two parts to this.
1) Make it so the contents of images/ is hidden
2) Make it so a person can access photos/somefile.jpg and have the server serve images/somefile.jpg
1) Hide contents of images/
Create a .htaccess
file in images/ and put the following in it
Order allow,deny
Deny from all
2) Serving the file
Create a .htaccess
file in the photos/ and put the following in it
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_.-]+).jpg$ photo.php?image_name=$1
And create the php file photo.php in the photos/ directory
<?php
if(isset($_GET['image_name'])){
if(file_exists("../images/" . $_GET['image_name'].".jpg")){
header('Content-Type: image/jpg');
readfile("../images/" . $_GET['image_name'].".jpg");
}
}
I'm doing that blind, but will test in a sec!