I have a file which contains a version number in the filename and is updated almost every month.(The version number is necessary for other software which needs that to work properly.)
To make published links with an old version number also workable, for user convenience, I wrote a php script which does a redirect with a 301 header, and provides the latest file with the current version number for download.
Now I found in the log file that old links with an old version number a kept in the index of search engines, and it's more and more growing that they aks for old files(urls), and even with the 301 redirect they do not update the stored links and ask for the old files over and over again.
After reading a while I found that the only way to get them out of the index is to send a 404 or 410 header, but it seems on the other hand, that this doesn't let me send a file with that header.
So the question is do you see any chance how I can send a 404 or 410 header to get old links away from search engine indexes, and at the same time provide the latest file for download to have old links still working for user comfort?