I am trying to get my Apache2 web application to push an arbitrary file extension as an octet-stream when pointed to by a browser.
i.e. Someone goes to blahblah/examples/example1.xyz I want the browser to download the .xyz file rather than just display it.
I have tried adding .htaccess in the root of the web app including
AddType application/octet-stream xyz
And I have also tried to add the mime type to /etc/apache2/mods-enabled/mime.conf
and /etc/mime.types
which is referenced as the types library from mime.conf
.
I have read a good deal about this on the internet and still haven't gotten this working. Any help would be greatly appreciated! Thanks.
MIME stands for Multimedia Internet Mail Extensions. The code used here is in mod_mime. c and is compiled in by default. It allows Apache to determine the type of a file from its extension. The list of MIME types that Apache already knows about is distributed in the file ..
A MIME type consists of two parts: a type and a subtype. Currently, there are ten registered types: application, audio, example, font, image, message, model, multipart, text, and video.
For detecting MIME-types, use the aptly named "mimetype" command. It has a number of options for formatting the output, it even has an option for backward compatibility to "file". But most of all, it accepts input not only as file, but also via stdin/pipe, so you can avoid temporary files when processing streams.
I believe you have to add a .
before the extension:
AddType application/octet-stream .xyz
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With