What is the AddType directive?

".htaccess" files allow users to specify what MIME type should be reported for specific files in their html directory. This MIME type will then be used by the browser when someone selects that file from the homepage.

The directive to use for these purposes is "AddType". This directive is added to the .htaccess file in the directory with the file(s) where you want to modify the default mimetypes.

The syntax is as follows:

AddType mime-type file-extension

Where "file-extension" the file extension that tells the server which files to associate the "mime-type" with.

For example, to add support for popular MacroMedia ShockWave extensions, the following can be added to the .htaccess file:

AddType application/x-director dcr
AddType application/x-director dir
AddType application/x-director dxr

This will tell the server to report all files with the extensions "dcr", "dir", and "dxr" to be of type "application/x-director".

For full details, see the Apache Documentation.

 

© Computing and Educational Technology Services | Report a Problem
cets@seas.upenn.edu | 215.898.4707