954,242 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Redirecting images depending on the page they are displayed on.

Hi everyone,
I would like to redirect my images to a php page so they'd be nicely displayed and I could track their frequentation. Let's say my display page is called openpic.php

The problem is, if I put an htaccess simple RewriteRule, all images will be subject to redirection, including the one that is displayed on openpic.php, thus creating a loop. (The image then appears as not available.)

My question is : I would like to redirect my images, except when they are displayed on openpic.php

Is that possible ?
I have tried a RewriteCond with HTTP_REFERER or REQUEST_URI but it does not seem to work. Maybe I got it wrong. I tried something like

RewriteCond %{HTTP_REFERER} !/openpic.php
RewriteRule [blabla.jpg -> openpic.php?file=blabla.jpg]


Can anyone help with my RewriteCond ? I'm not even sure what I'm trying is possible.

Thanks !! :o

Peutch
Newbie Poster
1 post since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: