Sending Correct Content-Type Headers with .htaccess

Learn how to set up your mime headers in .htaccess here.

Sample .htaccess file from Mozilla

The developers at Mozilla explain how the purpose of configuring the Apache web server to send many common file types with the correct MIME types

Provided .htaccess file

AddType text/css .css

AddType application/xhtml+xml .xhtml

AddType text/xml .xml

AddType image/svg+xml .svg .svgz
AddEncoding x-gzip .svgz

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

# Active Server Pages
AddType text/html .asp

# Favicons
AddType image/ .ico

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

# Adobe PDF
AddType application/pdf .pdf

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

# Microsoft multimedia
AddType video/x-ms-asf .asf .asx
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-wm .wm
AddType video/x-ms-wmx .wmx
AddType application/x-ms-wmz .wmz
AddType application/x-ms-wmd .wmd

AddType audio/x-mpegurl .m3u

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

# 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

# Bittorrent
AddType application/x-bittorrent .torrent

Common file extensions

that are good to know, organized by file format.

.doc Microsoft Word Document
.log Log File
.msg Mail Message
.rtf Rich Text Format File
.txt Text File
.wpd WordPerfect Document
.wps Microsoft Works Word Processor Document
.123 Lotus 1-2-3 Spreadsheet
.csv Comma Separated Values File
.dat Data File
.db Database File
.dll Dynamic Link Library
.mdb Microsoft Access Database
.pps PowerPoint Slide Show
.ppt PowerPoint Presentation
.sql Structured Query Language Data
.wks Microsoft Works Spreadsheet
.xls Microsoft Excel Spreadsheet
.xml XML File

2 thoughts on “Sending Correct Content-Type Headers with .htaccess

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s