Instead of directly accessing images, I need to use RewriteRule to redirect a set of images to be accessed via a script.
A RewriteRule is used for it:
RewriteRule ^Images/test/([^.\/]*)\.png /image.php?file=$1.png [R=301,L]
I would expect this to change:
But it does not do it.
But If I change the RewriteRule to the following:
RewriteRule ^Images2/test/([^.\/]*)\.png /image.php?file=$1.png [R=301,L]
The following works:
The difference is that Images exsits while Images2 does not exist. Is it possible to it working with an existing folder.
Any help on how to get the top example working?
Update: After carefully looking through the mod_rewrite documentation, I found this:
...Note that mod_rewrite tries to guess whether you have specified a file-system path or a URL-path by checking to see if the first segment of the path exists at the root of the file-system...
It seems that if the path is interpreted as a URL-path it works and if it is interpreted as a file-system path it fails.