From: pcs
+Note that changing the type or encoding of a file does not change the
+value of the
-Note that changing the type or encoding of a file does not change the
-value of the
-Please note that changing a file's type or encoding does not change
-the value of the
-
-
-The AddEncoding directive adds to the list of filename extensions which
-filenames may end in for the specified encoding type. Mime-enc
-is the mime encoding to use for documents ending in extension.
+The AddEncoding directive maps the given filename extensions to the
+specified encoding type. Mime-enc is the mime encoding to use
+for documents containing the extension. This mapping is added
+to any already in force, overriding any mappings that already exist
+for the same extension.
+
Example:
-
+This will cause filenames containing the .gz extension to be marked as
+encoded using the x-gzip encoding, and filenames containing the .Z
+extension to be marked as encoded with x-compress.
Old clients expect
+
+See also: Files with
+multiple extensions
+
AddHandler maps the filename extensions extension to the
-handler
-handler-name. For example, to activate CGI scripts
+handler handler-name. This
+mapping is added to any already in force, overriding any mappings that
+already exist for the same extension.
+
+For example, to activate CGI scripts
with the file extension " Once that has been put into your srm.conf or httpd.conf file, any
-file ending with "Last-Modified
header. Thus, previously cached
+copies may still be used by a client or proxy, with the previous headers.
+
+Files with Multiple Extensions
+
Files can have more than one extension, and the order of the
-extensions is normally irrelevant. For example, if the file
+extensions is normally irrelevant. For example, if the file
welcome.html.fr
maps onto content type text/html and
language French then the file welcome.fr.html
will map
onto exactly the same information. The only exception to this is if an
@@ -59,19 +65,26 @@ text/html but no language.
Last-Modified
header. Thus, previously cached
-copies may still be used by a client or proxy, with the previous headers.
+If more than one extension is given which maps onto the same type of
+meta-information, then the one to the right will be used. For example,
+if ".gif" maps to the MIME-type image/gif and ".html" maps to the
+MIME-type text/html, then the file welcome.gif.html
will
+be associated with the MIME-type "text/html".
Last-Modified
header. Previously cached
-copies may still be used by a client or proxy.
-
- Directives
+Care should be taken when a file with multiple extensions gets
+associated with both a MIME-type and a handler. This will usually
+result in the request being by the module associated with the
+handler. For example, if the .imap
extension is mapped to
+the handler "imap-file" (from mod_imap) and the .html
+extension is mapped to the MIME-type "text/html", then the file
+world.imap.html
will be associated with both the
+"imap-file" handler and "text/html" MIME-type. When it is processed,
+the "imap-file" handler will be used, and so it will be treated as a
+mod_imap imagemap file.
+
+Directives
-AddEncoding x-gzip gz
-AddEncoding x-compress Z
+
-This will cause files ending in .gz to be marked as encoded using the x-gzip
-encoding, and .Z files to be marked as encoded with x-compress. AddEncoding x-gzip gz
AddEncoding x-compress Z
x-gzip
and x-compress
,
however the standard dictates that they're equivalent to gzip
@@ -131,6 +146,11 @@ you should always use x-gzip
and x-compress
for these two specific encodings. More recent encodings, such as
deflate
should be specified without the x-
.
+
AddHandler
@@ -162,16 +182,25 @@ for these two specific encodings. More recent encodings, such as
1.1 and later.cgi
", you might use:
AddHandler cgi-script cgi
.cgi
" will be treated as a CGI
-program..cgi
" extension will be treated as a
+CGI program.
+ +See also: Files with +multiple extensions +
-The AddLanguage directive adds to the list of filename extensions which -filenames may end in for the specified content language. Mime-lang -is the mime language of files with names ending extension, -after any content encoding extensions have been removed. Example: -
-AddEncoding x-compress Z
-AddLanguage en .en
-AddLanguage fr .fr
-
+The AddLanguage directive maps the given filename extensions to the
+specified content language. Mime-lang is the mime language of
+filenames containing extension. This mapping is added to any
+already in force, overriding any mappings that already exist for the
+same extension.
+
+Example:
+AddEncoding x-compress Z
AddLanguage en .en
AddLanguage fr
+.fr
+
+Then the document xxxx.en.Z
will be treated as being a
+compressed English document (as will the document
+xxxx.Z.en
). Although the content language is reported to
+the client, the browser is unlikely to use this information. The
+AddLanguage directive is more useful for content negotiation, where
+the server returns one from several documents based on the client's
+language preference.+ +
-Then the document xxxx.en.Z
will be treated as being a compressed
-English document. Although the content language is reported to the client,
-the browser is unlikely to use this information. The AddLanguage directive
-is more useful for content negotiation, where the server returns one
-from several documents based on the client's language preference.
-The AddType directive adds to the list of filename extensions which
-filenames may end in for the specified content type. Mime-enc
-is the mime type to use for documents ending in extension.
-after content-encoding and language extensions have been removed. Example:
+The AddType directive maps the given filename extensions onto the
+specified content type. Mime-enc is the mime type to use for
+filenames containing extension. This mapping is added to any
+already in force, overriding any mappings that already exist for the
+same extension. This directive can be used to add mappings
+not listed in the mime types file (see the TypesConfig
directive).
+
+Example:
AddType image/gif GIF
It is recommended that new mime types be added using the AddType directive
rather than changing the TypesConfig file.Note that, unlike the NCSA httpd, this directive cannot be used to set the -type of particular files.
+ +
+ +See also: Files with +multiple extensions + +