htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Redirect images, unless accessed via specific url
PostPosted: 14 Jul 2008 23:21 
Offline

Joined: 14 Jul 2008 23:08
Posts: 1
I have many image directories within a Pictures directory and would like to block direct access to them.
But - I'd also like them to be visible through a flash based gallery that I've installed. If I block access to the image completely the gallery doesn't seem to be able to display them.

The setup that I have at the minute is a rewrite from subdirectories that goes to a php script that updates some xml about about what images are in that subdirectory, then forwards onto gallery.php?album={album_name}. I'd like it if the images were only visible through gallery.php.

The .htaccess file that I'm trying currently looks like this:
Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+)/$ http://mysite.com/buildgallery.php?album=$1 [L]


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !gallery [NC]
RewriteRule \.(gif|jpg|jpeg|png)$ http://mysite.com/no_access.jpg [NC,L]


And the gallery redirect, generation and picture display is working. BUT - the images are still visible through direct access. I thought the second rule would prevent this?

Thanks for any help.
Tom


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB