Peutch 0 Unverified User

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.