I have several thousand files that were uploaded to my site that are all stored in one big folder. I'd like to separate them out into folders by date. Each upload has a mysql row associated with it that includes the upload date/time, so I can write a script to go through and move them into appropriate folders. My question is, how would I make sure that these files are still accessible through their old/original URLs?
For example, right now a file might be located at http://example.com/files/abcdef.png
and after I move it, it would be located at something like http://example.com/files/2013/02/14/abcdef.png
how would I make the original URL load this file? Would there need to be a mysql query each time a file is loaded to determine where it is stored?