Defining File Types

MIME file types and file extensions play a major role in helping the server determine how a file should be handled. Specifying MIME options is also a major part of the httpd.conf file. The options involved are the following:

DefaultType Defines the MIME type that is used when the server cannot determine the type of a file. By default, this is set to text/html. Thus, when a file has no file extension, the server assumes that it is an HTML file.

AddEncoding Maps a MIME encoding type to a file extension. The Red Hat configuration contains two AddEncoding directives:

AddEncoding x-compress Z AddEncoding x-gzip gz tgz

The first directive maps the file extension .Z to the MIME encoding type x-compress. The second line maps the file extensions .gz and .tgz to MIME encoding type x-gzip.

AddLanguage Maps a MIME language type to a file extension.

LanguagePriority Sets the language encoding in case the client does not specify a preference.

AddType Maps a MIME file type to a file extension.

AddHandler Maps a file handler to a file extension. A file handler is a program that knows how to process a file. Simple examples of this are cgi-script, which is the handler for CGI files; and server-parsed, which handles Server Side Includes (SSI). (Both SSI and CGI are covered more later.)

Was this article helpful?

0 0

Post a comment