AddType

Name

AddType -- associates file names or extensions with mime types

indexer.conf

Synopsis

AddType [String | Regex] [Case | NoCase] {mime type} {pattern...}

Description

AddType associates file names and/or extensions with mime types, for protocols that don't automatically include mime types, such as file:/// and ftp://.

Note: The protocols http:// and https:// automatically include mime types in the response headers, so there is usually no need to use AddType if you index only HTTP and HTTPS servers. However, in case when a HTTP or a HTTPS server returns wrong mime type for some reasons, you can use UseRemoteContentType no to have mnoGoSearch ignore the response headers and to use the mime types defines by AddType commands instead.

The first two optional parameters specify comparison type. The default comparison type is String and Case (case insensitive string pattern match with ? and * wildcards meaning one character and any number of characters correspondingly).

If the mime type parameter contains spaces (for example, when character set specification is added), it should be put into single or double quotes.

Note: Russian webmasters often use *.htm extension for windows-1251 documents and *.html for UNIX koi8-r documents.

The pattern parameter can be repeated multiple times, to associate a mime type with multiple extensions in a single command.

Scope

AddType takes global effect for the entire configuration file and can be used multiple times.

Examples


AddType text/plain                      *.txt  *.pl *.js *.h *.c *.pm *.e
AddType text/html                       *.html *.htm
AddType text/rtf                        *.rtf
AddType application/pdf                 *.pdf
AddType "text/html; charset=koi8-r"       *.html
AddType "text/html; charset=windows-1251" *.htm
AddType Regex application/rar  \.r[0-9][0-9]$
AddType application/unknown *.*
    

See also

AddEncoding, DefaultContentType, Mime, UseRemoteContentType.