I’d like to apply a rewrite rule to all images within a certain directory. I tried this:
RewriteRule ^/source/([a-zA-Z-_]+).(jpg|png|jpeg|gif)$ /files/$1.$2 [NC,L]
But, it doesn’t seem to affect images within subdirectories of the files folder? (i.e., files/image.gif, files/8994/image2.png, files/subproject/3349/image3.jpg, should all be affected. Is there a way to do that?
Try this:
Remember DO NOT PUT
/in beginning of RewriteRule!(e.gsource/NOT/source/)edit:
it will rewrite
source/ajsbdkjasd.aksjdbf/asldkjbfaskdf.giftofiles/ajsbdkjasd.aksjdbf/asldkjbfaskdf.gif!