I havn’t found any solution to this searching the web.
I have a site (call it example.com) which hosts images stored in example.com/images/.
I want to let users get to the image at example.com/images/imagename.jpg by going to the adress example.com/imagename.
Imagenames consists of a-z, A-Z, 0-9, – and _.
Appreciate any solutions!
In the main Apache config (not .htaccess):
That says “if the pattern matches the required format then if the path isn’t a file, and if the path isn’t a directory, and if there is a file in the images folder under the document root that has ‘.jpg’ appended then do the redirect”.
If you’re doing it in .htaccess then you should just be able to replace:
with
but I’ve not had a chance to test it (I have a virtual private server and don’t enable .htaccess, because I’m the only one managing it and it reduces overheads on requests)