I'm building a web application with Codeigniter. I have some images on my server and I want that only logged users can see them. The login is made with the session class of codeigniter.
I don't want that external users can open the image
Opening this image I have to control if there is a valid codeigniter session and then give the image.
I've tried to made a controller called "images" and I've tried to add a rule in the htaccess file in order to call a function that checks the session and than sends the image to the client, but this
RewriteRule ^images/(.*)$ index.php?/images/$1 [L]
doesn't work. I don't know very well the rules of the htaccess files and I don't know if there are simplier ways to do this, but I want to preserve the correspondence between the url of the image and its position on the web server if it's possible.
Thank you