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