To add MIME types
What file is it is set by MIME types or rather we can say it defines what file types are referred by what file extensions. For example, the file extension ‘.zip’ refers to ZIP extension file and a file extension ‘.html’ refers to an HTML document.
To deal with the file correctly, the server generally needs this info. MIME types are named so due to their connection with email (Full form of MIME is “Multipurpose Internet Mail Extensions”). MIME means a specific format to specify the file type so they are not just called ‘file types’.
Make a .htaccess file by abiding the guidance that includes the below text and main instruction to set up a MIME type.
AddType text/html htm0
The added MIME type is specified by ‘AddType’. MIME type is specified by the second part, in the above case, its HTML or text, and the file extension is the last part which is ‘htm0’ in the example above.
With the below text code, you can resolve the commonly faced issue of SWF or MP3 files not getting played.
AddType application/x-shockwave-flash swf
There is a trick for forcing the download of a file through the ‘Save As’ feature there in web browser, just set type of MIME to octet-stream/application and there will be an immediate download prompt by the browser. Note here, this doesn’t work in some Internet Explorer versions.
The list of different types of MIME and the associations are given below. If your website is managed by you, and you know the file types you publish the resources in, then you don’t need to paste this full list of codes in your .htaccess file. But if your website has many other people who publish and contribute content to, then you may want to allow many different types of files to prevent any type of bad experience to any user. It is especially if your website has people with a lot of file-sharing activity, for example, a web app (where email handling is there) or a project management application (where many files are attached to a single project).
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