I have a directory of graphics that I now want to manage access to.
In the past, I have linked to the graphics like this:
Each graphic is called "image.jpg" and resides in a directory named by the graphic ID, in the example above 19002
Now, if the user of 19002 set permissions to "not public" it still serves it up.
So what I want is a quick PHP script that when someone links to the graphic like above, it is actually being served by:
Which will then check the permissions for that graphic and either serve it back or serve back a default "private" graphic.
I think I should be able to do this with mod_rewrite but despite googling and reading and tinkering for a few hours I can't get it to work. Hoping someone here can give me a quick example. Here was my latest attempt:
RewriteRule ^thesegraphics/([0-9]+)/image.jpg http://www.mysite.com/scripts/getimg.php?id=$1 [NC]