688N/A<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 919N/A <
title>Apache module mod_negotiation</
title>
919N/A <!-- Background white, links blue (unvisited), navy (visited), red (active) --> 919N/A <
body bgcolor="#FFFFFF" text="#000000" link="#0000FF" 919N/A vlink="#000080" alink="#FF0000">
919N/A <
h1 align="CENTER">Module mod_negotiation</
h1>
919N/A <
p>This module provides for <
a 688N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
1408N/A rel="Help"><
strong>Source File:</
strong></
a>
1408N/A rel="Help"><
strong>Module Identifier:</
strong></
a>
688N/A Content negotiation, or more accurately content selection, is
688N/A the selection of the document that best matches the clients
688N/A capabilities, from one of several available documents. There
688N/A are two implementations of this.
719N/A <
li>A type map (a file with the handler
719N/A <
code>type-map</
code>) which explicitly lists the files
719N/A containing the variants.</
li>
962N/A <
li>A MultiViews search (enabled by the MultiViews <
a 962N/A implicit filename pattern match, and choose from amongst the
719N/A <
li><
a href="#cachenegotiateddocs">CacheNegotiatedDocs</
a></
li>
719N/A <
li><
a href="#forcelanguagepriority">ForceLanguagePriority</
a></
li>
719N/A <
li><
a href="#languagepriority">LanguagePriority</
a></
li>
719N/A <
strong>See also</
strong>: <
a 962N/A A type map has the same format as RFC822 mail headers. It
719N/A contains document descriptions separated by blank lines, with
719N/A lines beginning with a hash character ('#') treated as
719N/A comments. A document description consists of several header
719N/A records; records may be continued on multiple lines if the
719N/A continuation lines start with spaces. The leading space will be
719N/A deleted and the lines concatenated. A header record consists of
719N/A a keyword name, which always ends in a colon, followed by a
719N/A value. Whitespace is allowed between the header name and value,
962N/A and between the tokens of value. The headers allowed are:
719N/A <
dt>Content-Encoding:</
dt>
719N/A <
dd>The encoding of the file. Apache only recognizes
719N/A encodings that are defined by an <
a 719N/A This normally includes the encodings <
code>x-compress</
code>
962N/A for compress'd files, and <
code>x-gzip</
code> for gzip'd
719N/A files. The <
code>x-</
code> prefix is ignored for encoding
719N/A <
dt>Content-Language:</
dt>
719N/A <
dd>The language of the variant, as an Internet standard
719N/A language tag (RFC 1766). An example is <
code>en</
code>,
719N/A <
dt>Content-Length:</
dt>
719N/A <
dd>The length of the file, in bytes. If this header is not
719N/A present, then the actual length of the file is used.</
dd>
719N/A The MIME media type of the document, with optional
719N/A parameters. Parameters are separated from the media type
719N/A and from one another by a semi-colon, with a syntax of
719N/A <
code>name=value</
code>. Common parameters include:
719N/A <
dd>an integer specifying the version of the media type.
719N/A <
dd>a floating-point number with a value in the range 0.0
688N/A to 1.0, indicating the relative 'quality' of this variant
719N/A compared to the other available variants, independent of
719N/A the client's capabilities. For example, a jpeg file is
688N/A usually of higher source quality than an ascii file if it
688N/A is attempting to represent a photograph. However, if the
688N/A resource being represented is ascii art, then an ascii
688N/A file would have a higher source quality than a jpeg file.
688N/A All qs values are therefore specific to a given
719N/A <
dd>The path to the file containing this variant, relative to
719N/A A MultiViews search is enabled by the MultiViews <
a 688N/A server reads the directory looking for all files named
688N/A <
code>foo.*</
code>, and effectively fakes up a type map which
688N/A names all those files, assigning them the same media types and
688N/A content-encodings it would have if the client had asked for one
719N/A of them by name. It then chooses the best match to the client's
688N/A requirements, and returns that document.
688N/A <
h2><
a id="cachenegotiateddocs" 688N/A name="cachenegotiateddocs">CacheNegotiatedDocs</
a>
688N/A rel="Help"><
strong>Syntax:</
strong></
a> CacheNegotiatedDocs
688N/A rel="Help"><
strong>Default:</
strong></
a>
688N/A <
code>CacheNegotiatedDocs off</
code><
br />
688N/A rel="Help"><
strong>Context:</
strong></
a> server config<
br />
688N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
688N/A rel="Help"><
strong>Module:</
strong></
a> mod_negotiation<
br />
719N/A rel="Help"><
strong>Compatibility:</
strong></
a>
688N/A CacheNegotiatedDocs is only available in Apache 1.1 and later.
688N/A The syntax changed in version 2.0.
688N/A <
p>If set, this directive allows content-negotiated documents
688N/A to be cached by proxy servers. This could mean that clients
688N/A behind those proxys could retrieve versions of the documents
688N/A that are not the best match for their abilities, but it will
688N/A make caching more efficient.</
p>
719N/A <
p>This directive only applies to requests which come from
688N/A the caching of negotiated documents, and this directive has no
688N/A <
p>Prior to version 2.0, CacheNegotiatedDocs did not take an
688N/A argument; it was turned on by the presence of the directive by
719N/A <
h2><
a id="forcelanguagepriority" 688N/A name="forcelanguagepriority">ForceLanguagePriority</
a> directive</
h2>
688N/A rel="Help"><
strong>Syntax:</
strong></
a> ForceLanguagePriority
688N/A None|Prefer|Fallback [Prefer|Fallback]<
br />
688N/A rel="Help"><
strong>Default:</
strong></
a>
688N/A <
code>ForceLanguagePriority None</
code><
br />
719N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
719N/A host, directory, .htaccess<
br />
688N/A rel="Help"><
strong>Override:</
strong></
a> FileInfo<
br />
688N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
688N/A rel="Help"><
strong>Module:</
strong></
a> mod_negotiation<
br />
688N/A rel="Help"><
strong>Compatibility:</
strong></
a>
688N/A Available in version 2.0.30 and later.</
p>
688N/A <
p>The <
code>ForceLanguagePriority</
code> directive uses the given
688N/A <
a href="#languagepriority">LanguagePriority</
a> to satisfy
719N/A negotation where the server could otherwise not return a single
688N/A <
p><
code>ForceLanguagePriority Prefer</
code> uses
962N/A <
code>LanguagePriority</
code> to serve a one valid result, rather
719N/A than returning an HTTP result 300 (MULTIPLE CHOICES) when there
719N/A are several equally valid choices. If the directives below were
719N/A given, and the user's Accept-Language header assigned en and de
719N/A each as quality .500 (equally acceptable) then then first matching
719N/A variant, en, will be served.</
p>
719N/A LanguagePriority en fr de<
br />
719N/A ForceLanguagePriority Prefer
719N/A <
p><
code>ForceLanguagePriority Fallback</
code> uses
719N/A <
code>LanguagePriority</
code> to serve a valid result, rather than
719N/A returning an HTTP result 406 (NOT ACCEPTABLE). If the directives
719N/A below were given, and the user's Accept-Language only permitted an
719N/A es langauge response, but such a variant isn't found, then the
719N/A first variant from the LanguagePriority list below will be
719N/A LanguagePriority en fr de<
br />
719N/A ForceLanguagePriority Fallback
719N/A <
p>Both options, Prefer and Fallback, may be specified, so either the
719N/A first matching variant from LanguagePriority will be served if more
719N/A that one variant is acceptable, or first available document will be
719N/A served if none of the variants matched the client's acceptable list of
719N/A <
h2><
a id="languagepriority" 719N/A name="languagepriority">LanguagePriority</
a> directive</
h2>
719N/A <!--%plaintext <?INDEX {\tt LanguagePriority} directive> --> 719N/A rel="Help"><
strong>Syntax:</
strong></
a> LanguagePriority
719N/A <
em>MIME-lang</
em> [<
em>MIME-lang</
em>] ...<
br />
719N/A rel="Help"><
strong>Context:</
strong></
a> server config, virtual
719N/A host, directory, .htaccess<
br />
719N/A rel="Help"><
strong>Override:</
strong></
a> FileInfo<
br />
719N/A rel="Help"><
strong>Status:</
strong></
a> Base<
br />
719N/A rel="Help"><
strong>Module:</
strong></
a> mod_negotiation
719N/A <
p>The LanguagePriority sets the precedence of language
719N/A variants for the case where the client does not express a
719N/A preference, when handling a MultiViews request. The list of
719N/A <
em>MIME-lang</
em> are in order of decreasing preference.
719N/A <
code>LanguagePriority en fr de</
code>
719N/A existed, but the browser did not express a language preference,
719N/A <
p>Note that this directive only has an effect if a 'best'
719N/A language cannot be determined by any other means or the <
a 719N/A href="#forcelanguagepriority">ForceLanguagePriority</
a> directive
719N/A is not <
code>None</
code>. Correctly implemented
HTTP/
1.1 requests
719N/A will mean this directive has no effect.</
p>
719N/A <
p><
strong>See also</
strong>: <
a 688N/A <
a href="#forcelanguagepriority">ForceLanguagePriority</
a>.