Moved apache code into a folder to help prepare for packaging where we dont want...
[httpd-crcsyncproxy.git] / apache / docs / manual / mod / mod_negotiation.html.en
blob277235e15cea7d77f736296f1dcc9dbbdc5f6a57
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7 -->
8 <title>mod_negotiation - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
13 <body>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.3</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
19 <div id="path">
20 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.3</a> &gt; <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_negotiation</h1>
23 <div class="toplang">
24 <p><span>Available Languages: </span><a href="../en/mod/mod_negotiation.html" title="English">&nbsp;en&nbsp;</a> |
25 <a href="../ja/mod/mod_negotiation.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
26 </div>
27 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides for <a href="../content-negotiation.html">content negotiation</a></td></tr>
28 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
29 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>negotiation_module</td></tr>
30 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_negotiation.c</td></tr></table>
31 <h3>Summary</h3>
33 <p>Content negotiation, or more accurately content selection, is
34 the selection of the document that best matches the clients
35 capabilities, from one of several available documents. There
36 are two implementations of this.</p>
38 <ul>
39 <li>A type map (a file with the handler
40 <code>type-map</code>) which explicitly lists the files
41 containing the variants.</li>
43 <li>A MultiViews search (enabled by the <code>MultiViews</code>
44 <code class="directive"><a href="../mod/core.html#options">Options</a></code>), where the server does
45 an implicit filename pattern match, and choose from amongst the
46 results.</li>
47 </ul>
48 </div>
49 <div id="quickview"><h3 class="directives">Directives</h3>
50 <ul id="toc">
51 <li><img alt="" src="../images/down.gif" /> <a href="#cachenegotiateddocs">CacheNegotiatedDocs</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#forcelanguagepriority">ForceLanguagePriority</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#languagepriority">LanguagePriority</a></li>
54 </ul>
55 <h3>Topics</h3>
56 <ul id="topics">
57 <li><img alt="" src="../images/down.gif" /> <a href="#typemaps">Type maps</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#multiviews">MultiViews</a></li>
59 </ul><h3>See also</h3>
60 <ul class="seealso">
61 <li><code class="directive"><a href="../mod/core.html#options">Options</a></code></li>
62 <li><code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code></li>
63 <li><a href="../content-negotiation.html">Content
64 Negotiation</a></li>
65 <li><a href="../env.html">Environment Variables</a></li>
66 </ul></div>
67 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
68 <div class="section">
69 <h2><a name="typemaps" id="typemaps">Type maps</a></h2>
70 <p>A type map has a format similar to RFC822 mail headers. It
71 contains document descriptions separated by blank lines, with
72 lines beginning with a hash character ('#') treated as
73 comments. A document description consists of several header
74 records; records may be continued on multiple lines if the
75 continuation lines start with spaces. The leading space will be
76 deleted and the lines concatenated. A header record consists of
77 a keyword name, which always ends in a colon, followed by a
78 value. Whitespace is allowed between the header name and value,
79 and between the tokens of value. The headers allowed are: </p>
81 <dl>
82 <dt><code>Content-Encoding:</code></dt>
83 <dd>The encoding of the file. Apache only recognizes
84 encodings that are defined by an <code class="directive"><a href="../mod/mod_mime.html#addencoding">AddEncoding</a></code> directive.
85 This normally includes the encodings <code>x-compress</code>
86 for compress'd files, and <code>x-gzip</code> for gzip'd
87 files. The <code>x-</code> prefix is ignored for encoding
88 comparisons.</dd>
90 <dt><code>Content-Language:</code></dt>
91 <dd>The language(s) of the variant, as an Internet standard
92 language tag (<a href="http://www.ietf.org/rfc/rfc1766.txt">RFC 1766</a>). An example is <code>en</code>,
93 meaning English. If the variant contains more than one
94 language, they are separated by a comma.</dd>
96 <dt><code>Content-Length:</code></dt>
97 <dd>The length of the file, in bytes. If this header is not
98 present, then the actual length of the file is used.</dd>
100 <dt><code>Content-Type:</code></dt>
102 <dd>
103 The <a class="glossarylink" href="../glossary.html#mime-type" title="see glossary">MIME media type</a> of
104 the document, with optional parameters. Parameters are
105 separated from the media type and from one another by a
106 semi-colon, with a syntax of <code>name=value</code>. Common
107 parameters include:
109 <dl>
110 <dt><code>level</code></dt>
111 <dd>an integer specifying the version of the media type.
112 For <code>text/html</code> this defaults to 2, otherwise
113 0.</dd>
115 <dt><code>qs</code></dt>
116 <dd>a floating-point number with a value in the range 0.0
117 to 1.0, indicating the relative 'quality' of this variant
118 compared to the other available variants, independent of
119 the client's capabilities. For example, a jpeg file is
120 usually of higher source quality than an ascii file if it
121 is attempting to represent a photograph. However, if the
122 resource being represented is ascii art, then an ascii
123 file would have a higher source quality than a jpeg file.
124 All <code>qs</code> values are therefore specific to a given
125 resource.</dd>
126 </dl>
128 <div class="example"><h3>Example</h3><p><code>
129 Content-Type: image/jpeg; qs=0.8
130 </code></p></div>
131 </dd>
133 <dt><code>URI:</code></dt>
134 <dd>uri of the file containing the variant (of the given
135 media type, encoded with the given content encoding). These
136 are interpreted as URLs relative to the map file; they must
137 be on the same server (!), and they must refer to files to
138 which the client would be granted access if they were to be
139 requested directly.</dd>
141 <dt><code>Body:</code></dt>
142 <dd>New in Apache 2.0, the actual content of the resource may
143 be included in the type-map file using the Body header. This
144 header must contain a string that designates a delimiter for
145 the body content. Then all following lines in the type map
146 file will be considered part of the resource body until the
147 delimiter string is found.
149 <div class="example"><h3>Example:</h3><p><code>
150 Body:----xyz----<br />
151 &lt;html&gt;<br />
152 &lt;body&gt;<br />
153 &lt;p&gt;Content of the page.&lt;/p&gt;<br />
154 &lt;/body&gt;<br />
155 &lt;/html&gt;<br />
156 ----xyz----
157 </code></p></div>
158 </dd>
159 </dl>
160 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
161 <div class="section">
162 <h2><a name="multiviews" id="multiviews">MultiViews</a></h2>
163 <p>A MultiViews search is enabled by the <code>MultiViews</code>
164 <code class="directive"><a href="../mod/core.html#options">Options</a></code>. If the server receives a
165 request for <code>/some/dir/foo</code> and
166 <code>/some/dir/foo</code> does <em>not</em> exist, then the
167 server reads the directory looking for all files named
168 <code>foo.*</code>, and effectively fakes up a type map which
169 names all those files, assigning them the same media types and
170 content-encodings it would have if the client had asked for one
171 of them by name. It then chooses the best match to the client's
172 requirements, and returns that document.</p>
174 <p>The <code class="directive"><a href="../mod/mod_mime.html#multiviewsmatch">MultiViewsMatch</a></code>
175 directive configures whether Apache will consider files
176 that do not have content negotiation meta-information assigned
177 to them when choosing files.</p>
178 </div>
179 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
180 <div class="directive-section"><h2><a name="CacheNegotiatedDocs" id="CacheNegotiatedDocs">CacheNegotiatedDocs</a> <a name="cachenegotiateddocs" id="cachenegotiateddocs">Directive</a></h2>
181 <table class="directive">
182 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Allows content-negotiated documents to be
183 cached by proxy servers</td></tr>
184 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CacheNegotiatedDocs On|Off</code></td></tr>
185 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>CacheNegotiatedDocs Off</code></td></tr>
186 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
187 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
188 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_negotiation</td></tr>
189 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The syntax changed in version 2.0.</td></tr>
190 </table>
191 <p>If set, this directive allows content-negotiated documents
192 to be cached by proxy servers. This could mean that clients
193 behind those proxys could retrieve versions of the documents
194 that are not the best match for their abilities, but it will
195 make caching more efficient.</p>
197 <p>This directive only applies to requests which come from
198 HTTP/1.0 browsers. HTTP/1.1 provides much better control over
199 the caching of negotiated documents, and this directive has no
200 effect in responses to HTTP/1.1 requests.</p>
202 <p>Prior to version 2.0,
203 <code class="directive">CacheNegotiatedDocs</code> did not take an
204 argument; it was turned on by the presence of the directive by
205 itself.</p>
207 </div>
208 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
209 <div class="directive-section"><h2><a name="ForceLanguagePriority" id="ForceLanguagePriority">ForceLanguagePriority</a> <a name="forcelanguagepriority" id="forcelanguagepriority">Directive</a></h2>
210 <table class="directive">
211 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Action to take if a single acceptable document is not
212 found</td></tr>
213 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ForceLanguagePriority None|Prefer|Fallback [Prefer|Fallback]</code></td></tr>
214 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ForceLanguagePriority Prefer</code></td></tr>
215 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
216 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
217 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
218 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_negotiation</td></tr>
219 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.30 and later</td></tr>
220 </table>
221 <p>The <code class="directive">ForceLanguagePriority</code> directive uses
222 the given <code class="directive"><a href="#languagepriority">LanguagePriority</a></code> to satisfy
223 negotation where the server could otherwise not return a single
224 matching document.</p>
226 <p><code>ForceLanguagePriority Prefer</code> uses
227 <code>LanguagePriority</code> to serve a one valid result, rather
228 than returning an HTTP result 300 (MULTIPLE CHOICES) when there
229 are several equally valid choices. If the directives below were
230 given, and the user's <code>Accept-Language</code> header assigned
231 <code>en</code> and <code>de</code> each as quality <code>.500</code>
232 (equally acceptable) then the first matching variant, <code>en</code>,
233 will be served.</p>
235 <div class="example"><p><code>
236 LanguagePriority en fr de<br />
237 ForceLanguagePriority Prefer
238 </code></p></div>
240 <p><code>ForceLanguagePriority Fallback</code> uses
241 <code class="directive"><a href="#languagepriority">LanguagePriority</a></code> to
242 serve a valid result, rather than returning an HTTP result 406
243 (NOT ACCEPTABLE). If the directives below were given, and the user's
244 <code>Accept-Language</code> only permitted an <code>es</code>
245 language response, but such a variant isn't found, then the first
246 variant from the <code class="directive"><a href="#languagepriority">LanguagePriority</a></code> list below will be served.</p>
248 <div class="example"><p><code>
249 LanguagePriority en fr de<br />
250 ForceLanguagePriority Fallback
251 </code></p></div>
253 <p>Both options, <code>Prefer</code> and <code>Fallback</code>, may be
254 specified, so either the first matching variant from <code class="directive"><a href="#languagepriority">LanguagePriority</a></code> will be served if
255 more than one variant is acceptable, or first available document will
256 be served if none of the variants matched the client's acceptable list
257 of languages.</p>
259 <h3>See also</h3>
260 <ul>
261 <li><code class="directive"><a href="../mod/mod_mime.html#addlanguage">AddLanguage</a></code></li>
262 </ul>
263 </div>
264 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
265 <div class="directive-section"><h2><a name="LanguagePriority" id="LanguagePriority">LanguagePriority</a> <a name="languagepriority" id="languagepriority">Directive</a></h2>
266 <table class="directive">
267 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The precendence of language variants for cases where
268 the client does not express a preference</td></tr>
269 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LanguagePriority <var>MIME-lang</var> [<var>MIME-lang</var>]
270 ...</code></td></tr>
271 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
272 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
273 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
274 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_negotiation</td></tr>
275 </table>
276 <p>The <code class="directive">LanguagePriority</code> sets the precedence
277 of language variants for the case where the client does not
278 express a preference, when handling a MultiViews request. The list
279 of <var>MIME-lang</var> are in order of decreasing preference.</p>
281 <div class="example"><h3>Example:</h3><p><code>
282 LanguagePriority en fr de
283 </code></p></div>
285 <p>For a request for <code>foo.html</code>, where
286 <code>foo.html.fr</code> and <code>foo.html.de</code> both
287 existed, but the browser did not express a language preference,
288 then <code>foo.html.fr</code> would be returned.</p>
290 <p>Note that this directive only has an effect if a 'best'
291 language cannot be determined by any other means or the <code class="directive"><a href="#forcelanguagepriority">ForceLanguagePriority</a></code> directive
292 is not <code>None</code>. In general, the client determines the
293 language preference, not the server.</p>
295 <h3>See also</h3>
296 <ul>
297 <li><code class="directive"><a href="../mod/mod_mime.html#addlanguage">AddLanguage</a></code></li>
298 </ul>
299 </div>
300 </div>
301 <div class="bottomlang">
302 <p><span>Available Languages: </span><a href="../en/mod/mod_negotiation.html" title="English">&nbsp;en&nbsp;</a> |
303 <a href="../ja/mod/mod_negotiation.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
304 </div><div id="footer">
305 <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
306 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
307 </body></html>