I have a PHP app that creates a CSV file which is forced to download using headers. Here\'s the relevant part of the code:
header(\'Content-Type: applicatio
The header you are sending are HTTP headers. The browser takes that as a page request and processes it as a page. And in your case, a page it needs to download.
So adding a redirect header to that confuses the whole process of downloading the file (since headers are collected, generated into one header and then sent to the browser, you can try this by setting multiple redirect headers IIRC)