Here is what I have for now in my .htaccess and this should work in future:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
The question is:
how can I make this rewrite /tmp/some_image.png -> /image.php?file=some_image.png
I’ve tried to make my own rule, but without success.
Thanks.
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:
You could check for other extensions as well:
Or if you don’t care (everything is an image in your tmp folder. Though i wouldn’t recommend this)
If it’s not a physical file you can put any one of these at the end of your rules.