I'm working on a legacy codebase, with three different folders of images. An image could be in any one of the three folders, in a pretty much random manner.
I initially attempted to check for file existence within PHP; however, images are being displayed in tons of places, and I'm hoping I can just achieve the same thing with an htaccess file. However, so far no luck.
Here's what I've got so far:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^Folder_1/(.*)$ Folder_2/$1 [L,NC]
RewriteRule ^Folder_2/(.*)$ Folder_3/$1 [L,NC]
What I'd like to happen is for any image request that doesn't exist, check the other two folders, in any order, for its existence. So, if someone requests Folder_3/image.png, it'll check Folder_1/image.png, then Folder_2/image.png
Any suggestions for how to write the htaccess file?