I have a rewrite map associating pictures hash to the real path (to be kept secret) of the picture. With a single rewrite rule I can give back the picture with the hash as the url, that's fine.
However this is the path that I would like to keep secret, not the picture name. Even if the name is not secret, I don't want users to directly access with server/image_name.jpg I thus think that providing the filename in the content-disposition header is OK.
I came up with this:
RewriteMap redirector txt:C:/Apache24/url-mapping.txt
RewriteEngine On
RewriteRule ^/i/(.*)$ ${redirector:$1} [E=filename:${redirector:$1}]
Header set "Content-disposition" "attachment; filename=%{filename}e"
But the mapping is of this shape:
fa54e01623f625b1a6160fa0fee24112 /images/apath/to/picturename.png
And the current configuration takes the whole path, not the last part.
So my questions are:
- is there another way to achieve what I want to do?
- with the Content-disposition solution, how and where can I take a part of my variable filename to really have the filename?
Thanks!