I am redesigning a 5.6 site in version 9. The 5.6 version has hundreds of files, and my client has linked directly to the download URL of many of these files in various external place (i.e. https://mydomain.com/index.php/download_file/2812/). When i create the new site in version 9, I won’t be able to retain these original URLs since version 9 now uses FileUUID. This means my client will have to find and relink hundreds of links. Additionally, I can’t seem to user 301 redirects either since the download_file link automatically converts to the actual file path based on the fID (in 5.6).
Does anyone have any ideas for a way to somehow handle this? If I could get redirects to work I’d at least have an option, but I can’t even get that to work.
About the only way that I can think to do this would be to somehow set an attribute on the new site that’s like old_site_fid then override the download_file function to see if the first param is numeric, if it is lookup the file by the old_site_fid attribute and serve that.
If you aren’t using the Migration Tool to move your files from one site to another it’ll be hard to map them though because you won’t have any idea which file is which. If you use the Migration Tool at least the path on the server will be in the same folder structure.
Thank you so much for replying! Would it be possible for you to point me to where I could modify the download_file function? I was trying to modify the download_file.php single page in hopes that it was somehow contained there, but I’m just not savvy enough to know where else to look. I’m thinking maybe if I can intercept the download_file function to conditionally run based on the pattern of the incoming link, and use a custom file attribute like you suggested to hook off of, I could maybe provide a version of a redirect that way.
I will look at the migration tool too, I’ve never used it and this is a good reason to try.