MIME Types Using .htaccess

Here we going to see MIME types using .htaccess. MIME is short for Multipurpose Internet Mail Extensions, But also modern MIME types apply to other services in addition to email. The MIME types help to identify what a file is or what file type is. Here the example, MIME types can assist a browser to determine what type of content is about to be processed so the browser can do the proper controls, media player or plugins to display the data perfectly.

The following instruction will help you to do in a proper way. For this first create a .htaccess file and add the following code.

# HTML #
AddType text/html .html .htm 

The first “AddType” defines that you are adding a MIME type. The second section is the MIME type in this case text or HTML and the last one is an extension of the file ( example “.html”).

# HTML #
AddType text/html .html .htm 

# (SSI) Server Side Includes #
AddType text/html .shtml

# CSS #
AddType text/css .css

AddType application/xhtml+xml .xhtml

# XML #
AddType text/xml .xml

# Active Server Pages #
AddType text/html .asp

# Favicons #
AddType image/vnd.microsoft.icon .ico

AddType image/gif .gif .GIF 
AddType image/x-xpixmap .xpm 
AddType image/x-portable-anymap .pnm 
AddType image/jpeg .jpeg .jpg .jpe .JPG 
AddType image/x-portable-graymap .pgm 
AddType image/tiff .tiff .tif 
AddType image/x-cmu-raster .ras 
AddType image/x-rgb .rgb 
AddType image/x-portable-bitmap .pbm 
AddType image/ief .ief 
AddType image/x-portable-pixmap .ppm 
AddType image/x-xwindowdump .xwd
AddType image/x-xbitmap .xbm 

# SVG #
AddType image/svg+xml .svg .svgz

# Adobe PDF #
AddType application/pdf .pdf

# Real #
AddType audio/x-pn-realaudio-plugin .rpm
AddType audio/vnd.rn-realaudio .ra .ram
AddType video/vnd.rn-realvideo .rv
AddType application/vnd.rn-realmedia .rm

# Microsoft multimedia #
AddType application/x-ms-wmz .wmz
AddType application/x-ms-wmd .wmd
AddType audio/x-ms-wma .wma
AddType audio/x-ms-wax .wax
AddType video/x-ms-wmv .wmv
AddType video/x-ms-wvx .wvx
AddType video/x-ms-asf .asf .asx
AddType video/x-ms-wm .wm
AddType video/x-ms-wmx .wmx

# MPEG #
AddType audio/x-mpegurl .m3u

# Binary Compressed files and archives #
AddType application/octet-stream .dmg .bin .exe
AddType application/zip .zip
AddType application/x-gtar .gtar
AddType application/x-rar-compressed .rar
AddType application/x-gzip .gz

# Java #
AddType application/x-java-applet .class

# Quicktime movies #
AddType video/quicktime .mov .qt

# XBM files #
AddType image/x-xbitmap .xbm

# WAV files #
AddType audio/x-wav .wav

# Macromedia #
AddType application/x-authorware-seg .aas
AddType application/x-authorware-bin .aab
AddType application/x-shockwave-flash .swf
AddType application/x-director .dir .dcr .dxr .fgd
AddType image/x-freehand .fh4 .fh5 .fh7 .fhc .fh
AddType application/x-authorware-map .aam

Was this article helpful?

Yes No

How can we improve it?


We appreciate your helpul feedback!

Your answer will be used to improve our content. The more feedback you give us, the better our pages can be.

Follow us on social media:

Facebook Pinterest
Share via:


Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts.

Leave a Reply