Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache2 server mime types

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.

like image 775
Jay Elrod Avatar asked Dec 12 '12 19:12

Jay Elrod


People also ask

What is MIME type in Apache?

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 ..

What are the different MIME types?

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.

How do I find MIME type?

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.


1 Answers

I believe you have to add a . before the extension:

AddType application/octet-stream .xyz

like image 153
jchapa Avatar answered Sep 21 '22 05:09

jchapa