Here is what I have for now in my .htaccess
and this should work in future:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) http
Correct answer is:
RewriteRule ^/?tmp/(.*\.png)$ captcha.php?file=$1 [L]
thx goes to Humbedooh@freenode
Is /tmp a directory accessible by your web-server? I'm hoping it's a separate /tmp folder and not the actual /tmp of the server as that would be a security risk.
Anyway if the image is a physical file then you need to put this after your rewrite to force HTTPS and before the conditions checking if it's a file or directory:
RewriteRule ^/tmp/([^\.]+)\.png$ /image.php?file=$1.png [NC,L]
You could check for other extensions as well:
RewriteRule ^/tmp/([^\.]+)\.(png|jpg|gif)$ /image.php?file=$1.$2 [NC,L]
Or if you don't care (everything is an image in your tmp folder. Though i wouldn't recommend this)
RewriteRule ^/tmp/(.*)$ /image.php?file=$1 [NC,L]
If it's not a physical file you can put any one of these at the end of your rules.