Is / tmp a directory available on your web server? I hope this is a separate / tmp folder and not the actual / tmp server, as this will be a security risk.
In any case, if the image is a physical file, you need to place it after overwriting in order to force HTTPS and check before the conditions whether it is a file or a directory:
RewriteRule ^/tmp/([^\.]+)\.png$ /image.php?file=$1.png [NC,L]
You can also check other extensions:
RewriteRule ^/tmp/([^\.]+)\.(png|jpg|gif)$ /image.php?file=$1.$2 [NC,L]
Or if you don't care (all this image is in your tmp folder. Although I would not recommend this)
RewriteRule ^/tmp/(.*)$ /image.php?file=$1 [NC,L]
If this is not a physical file, you can put any of them at the end of your rules.
Cfreak
source share