How To Add Mime-Types Using .htaccess
MIME types is a description of what a file is, how it behaves and how to open
it.
For example, if you download an .avi from the internet and you double click
it, Somehow the Windows Media Player will start by its self and play the .avi
file. That's because somewhere inside the innerworkings of Windows there is a
place called the regestry and in there one of the many things it does is tell
each program what file it should open, and each file what program it will open
and how to behave.
That is a MIME type, exactly a central point to let your browser or PC know
how to handle a certain file type. Your broser already knows about some types,
but for those odd ones, there is the .htaccess file in combination with MIME
types to make everything work correctly.
To start working with MIME types, just open your .htaccess file and add the
following to it:
AddType text/html htm0
"AddType" specifies that you are adding a MIME type.
The second part is the MIME type you´re adding. In this case its a text or html
file with an extension htm0
A common issue with MP3 or SWF files not playing can be resolved with the
following line:
AddType application/x-shockwave-flash swf
A very handy trick, is to force a file to be downloaded. Sometimes you have a
mp3 file that loads in a player but you want it to download it with a "Save As"
window. All you have to do is set the MIME type to application/octet-stream and
the browser will immediately prompt for download. Please note that this doesn't
always work in Microsoft Internet Explorer.
Here is a quick list of some common MIME types and some associations:
AddType text/html .html .htm
AddType text/plain .txt
AddType text/richtext .rtx
AddType text/tab-separated-values .tsv
AddType text/x-setext .etx
AddType text/x-server-parsed-html .shtml .sht
AddType application/macbinhex-40 .hqx
AddType application/netalivelink .nel
AddType application/netalive .net
AddType application/news-message-id
AddType application/news-transmission
AddType application/octet-stream .bin .exe
AddType application/oda .oda
AddType application/pdf .pdf
AddType application/postscript .ai .eps .ps
AddType application/remote-printing
AddType application/rtf .rtf
AddType application/slate
AddType application/zip .zip
AddType application/x-mif .mif
AddType application/wita
AddType application/wordperfect5.1
AddType application/x-csh .csh
AddType application/x-dvi .dvi
AddType application/x-hdf .hdf
AddType application/x-latex .latex
AddType application/x-netcdf .nc .cdf
AddType application/x-sh .sh
AddType application/x-tcl .tcl
AddType application/x-tex .tex
AddType application/x-texinfo .texinfo .texi
AddType application/x-troff .t .tr .roff
AddType application/x-troff-man .man
AddType application/x-troff-me .me
AddType application/x-troff-ms .ms
AddType application/x-wais-source .src
AddType application/x-bcpio .bcpio
AddType application/x-cpio .cpio
AddType application/x-gtar .gtar
AddType application/x-shar .shar
AddType application/x-sv4cpio .sv4cpio
AddType application/x-sv4crc .sv4crc
AddType application/x-tar .tar
AddType application/x-ustar .ustar
AddType application/x-director .dcr
AddType application/x-director .dir
AddType application/x-director .dxr
AddType application/x-onlive .sds
AddType application/x-httpd-cgi .cgi
AddType image/gif .gif .GIF
AddType image/ief .ief
AddType image/jpeg .jpeg .jpg .jpe .JPG
AddType image/tiff .tiff .tif
AddType image/x-cmu-raster .ras
AddType image/x-portable-anymap .pnm
AddType image/x-portable-bitmap .pbm
AddType image/x-portable-graymap .pgm
AddType image/x-portable-pixmap .ppm
AddType image/x-rgb .rgb
AddType image/x-xbitmap .xbm
AddType image/x-xpixmap .xpm
AddType image/x-xwindowdump .xwd
AddType audio/basic .au .snd
AddType audio/x-aiff .aif .aiff .aifc
AddType audio/x-wav .wav
AddType audio/x-pn-realaudio .ram
AddType audio/x-midi .mid
AddType video/mpeg .mpeg .mpg .mpe
AddType video/quicktime .qt .mov
AddType video/x-msvideo .avi
AddType video/x-sgi-movie .movie
AddType message/external-body
AddType message/news
AddType message/partial
AddType message/rfc822
AddType multipart/alternative
AddType multipart/appledouble
AddType multipart/digest
AddType multipart/mixed
AddType multipart/parallel
AddType x-world/x-vrml .wrl
There is no need to add them all to your .htaccess file, just add the ones
you need, if any.
Review It
You might also be interested in:
|
|
|