First of all, I'm sorry about the title. I couldn't find a better one.
I've a image file, generated by a PHP script. this script (image) is connected to a database and saves its referrer url in a table. Because the output image doesn't change, I think it's better to cache it.
But as I know, if I cache 1 file (for example http://www.example.com/img.png.php), on every pages, the browsers reads it from cache. and it's not good for my script. because on the first call, it save the referrer url and cached by browser. And on the next calls, on different websites (referrers), cached version will be used and browser don't send any request to the server, and finally referrer url won't save in the database.
Can I say to browser, please cache 1 copy of the image for each domain? I mean:
http://wwww.abc.com/index.html
sends a request to get my image (script)browser checks its cache, and doesn't find it. so get it from the server. and PHP script saves the referrer url.
the user goes to another page of ABC.COM. (for example:
http://wwww.abc.com/about.html
) browser check the cache, it finds it. so doesn't send a request to the server to get the file content. and PHP script won't run.another site (
http://wwww.efg.com/index.html
) sends a request to get my image (script) browser checks cache, and WILL NOT find it. so send a request for file content. and PHP script runs...............................
Is it possible? (sorry for long text, with a lots of grammatical problems)