I have a bunch of directories full of PDF files and want to compress them all to save some space, so I gzip them all. Is there a way to set up Apache to serve as PDF files? Something like a rewrite from .pdf$ to .pdf.gz but ... transparently? Right now I edit the wikip page and change all the links ending in .pdf to .pdf.gz; when I follow the resulting link, the browser downloads the file and calls whatever is used to handle archives and therefore the PDF is no longer shown by the browser. Something like assigning a magic application/pdf+gzip to the .pdf.gz extension maybe?
OK, I think I found a website with the answer I was looking for. The key phrase is in the title of this post: "Serving pre-compressed files using Apache". Sometimes searching for stuff is hard just because you don't know what it's called. 😅
https://feeding.cloud.geek.nz/posts/serving-pre-compressed-files-using/