1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 5 6<html xmlns="http://www.w3.org/1999/xhtml"> 7 <head> 8 <meta name="generator" content="HTML Tidy, see www.w3.org" /> 9 10 <title>Apache module mod_negotiation</title> 11 </head> 12 <!-- Background white, links blue (unvisited), navy (visited), red (active) --> 13 14 <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" 15 vlink="#000080" alink="#FF0000"> 16 <div align="CENTER"> 17 <img src="../images/sub.gif" alt="[APACHE DOCUMENTATION]" /> 18 19 <h3>Apache HTTP Server Version 1.3</h3> 20 </div> 21 22 23 <h1 align="CENTER">Module mod_negotiation</h1> 24 25 <p>This module provides for <a 26 href="../content-negotiation.html">content negotiation</a>.</p> 27 28 <p><a href="module-dict.html#Status" 29 rel="Help"><strong>Status:</strong></a> Base<br /> 30 <a href="module-dict.html#SourceFile" 31 rel="Help"><strong>Source File:</strong></a> 32 mod_negotiation.c<br /> 33 <a href="module-dict.html#ModuleIdentifier" 34 rel="Help"><strong>Module Identifier:</strong></a> 35 negotiation_module</p> 36 37 <h2>Summary</h2> 38 Content negotiation, or more accurately content selection, is 39 the selection of the document that best matches the clients 40 capabilities, from one of several available documents. There 41 are two implementations of this. 42 43 <ul> 44 <li>A type map (a file with the handler 45 <code>type-map</code>) which explicitly lists the files 46 containing the variants.</li> 47 48 <li>A MultiViews search (enabled by the MultiViews <a 49 href="core.html#options">Option</a>, where the server does an 50 implicit filename pattern match, and choose from amongst the 51 results.</li> 52 </ul> 53 54 <h2>Directives</h2> 55 56 <ul> 57 <li><a 58 href="#cachenegotiateddocs">CacheNegotiatedDocs</a></li> 59 60 <li><a href="#languagepriority">LanguagePriority</a></li> 61 </ul> 62 <strong>See also</strong>: <a 63 href="./mod_mime.html#defaultlanguage">DefaultLanguage</a>, <a 64 href="./mod_mime.html#addencoding">AddEncoding</a>, <a 65 href="./mod_mime.html#addlanguage">AddLanguage</a>, <a 66 href="./mod_mime.html#addtype">AddType</a>, and <a 67 href="core.html#options">Options</a>. 68 69 <h2>Type maps</h2> 70 A type map has the same format as 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: 80 81 <dl> 82 <dt>Content-Encoding:</dt> 83 84 <dd>The encoding of the file. Apache only recognizes 85 encodings that are defined by an <a 86 href="mod_mime.html#addencoding">AddEncoding</a> directive. 87 This normally includes the encodings <code>x-compress</code> 88 for compress'd files, and <code>x-gzip</code> for gzip'd 89 files. The <code>x-</code> prefix is ignored for encoding 90 comparisons.</dd> 91 92 <dt>Content-Language:</dt> 93 94 <dd>The language of the variant, as an Internet standard 95 language tag (RFC 1766). An example is <code>en</code>, 96 meaning English.</dd> 97 98 <dt>Content-Length:</dt> 99 100 <dd>The length of the file, in bytes. If this header is not 101 present, then the actual length of the file is used.</dd> 102 103 <dt>Content-Type:</dt> 104 105 <dd> 106 The MIME media type of the document, with optional 107 parameters. Parameters are separated from the media type 108 and from one another by a semi-colon, with a syntax of 109 <code>name=value</code>. Common parameters include: 110 111 <dl> 112 <dt>level</dt> 113 114 <dd>an integer specifying the version of the media type. 115 For <code>text/html</code> this defaults to 2, otherwise 116 0.</dd> 117 118 <dt>qs</dt> 119 120 <dd>a floating-point number with a value in the range 0.0 121 to 1.0, indicating the relative 'quality' of this variant 122 compared to the other available variants, independent of 123 the client's capabilities. For example, a jpeg file is 124 usually of higher source quality than an ascii file if it 125 is attempting to represent a photograph. However, if the 126 resource being represented is ascii art, then an ascii 127 file would have a higher source quality than a jpeg file. 128 All qs values are therefore specific to a given 129 resource.</dd> 130 </dl> 131 Example: 132 133 <blockquote> 134 <code>Content-Type: image/jpeg; qs=0.8</code> 135 </blockquote> 136 </dd> 137 138 <dt>URI:</dt> 139 140 <dd>The path to the file containing this variant, relative to 141 the map file.</dd> 142 </dl> 143 144 <h2>MultiViews</h2> 145 A MultiViews search is enabled by the MultiViews <a 146 href="core.html#options">Option</a>. If the server receives a 147 request for <code>/some/dir/foo</code> and 148 <code>/some/dir/foo</code> does <em>not</em> exist, then the 149 server reads the directory looking for all files named 150 <code>foo.*</code>, and effectively fakes up a type map which 151 names all those files, assigning them the same media types and 152 content-encodings it would have if the client had asked for one 153 of them by name. It then chooses the best match to the client's 154 requirements, and returns that document. 155 <hr /> 156 157 <h2><a id="cachenegotiateddocs" 158 name="cachenegotiateddocs">CacheNegotiatedDocs</a> 159 directive</h2> 160 <a href="directive-dict.html#Syntax" 161 rel="Help"><strong>Syntax:</strong></a> 162 CacheNegotiatedDocs<br /> 163 <a href="directive-dict.html#Context" 164 rel="Help"><strong>Context:</strong></a> server config<br /> 165 <a href="directive-dict.html#Status" 166 rel="Help"><strong>Status:</strong></a> Base<br /> 167 <a href="directive-dict.html#Module" 168 rel="Help"><strong>Module:</strong></a> mod_negotiation<br /> 169 <a href="directive-dict.html#Compatibility" 170 rel="Help"><strong>Compatibility:</strong></a> 171 CacheNegotiatedDocs is only available in Apache 1.1 and later. 172 173 <p>If set, this directive allows content-negotiated documents 174 to be cached by proxy servers. This could mean that clients 175 behind those proxys could retrieve versions of the documents 176 that are not the best match for their abilities, but it will 177 make caching more efficient.</p> 178 179 <p>This directive only applies to requests which come from 180 HTTP/1.0 browsers. HTTP/1.1 provides much better control over 181 the caching of negotiated documents, and this directive has no 182 effect in responses to HTTP/1.1 requests.</p> 183 <hr /> 184 185 <h2><a id="languagepriority" 186 name="languagepriority">LanguagePriority</a> directive</h2> 187 <!--%plaintext <?INDEX {\tt LanguagePriority} directive> --> 188 <a href="directive-dict.html#Syntax" 189 rel="Help"><strong>Syntax:</strong></a> LanguagePriority 190 <em>MIME-lang</em> [<em>MIME-lang</em>] ...<br /> 191 <a href="directive-dict.html#Context" 192 rel="Help"><strong>Context:</strong></a> server config, virtual 193 host, directory, .htaccess<br /> 194 <a href="directive-dict.html#Override" 195 rel="Help"><strong>Override:</strong></a> FileInfo<br /> 196 <a href="directive-dict.html#Status" 197 rel="Help"><strong>Status:</strong></a> Base<br /> 198 <a href="directive-dict.html#Module" 199 rel="Help"><strong>Module:</strong></a> mod_negotiation 200 201 <p>The LanguagePriority sets the precedence of language 202 variants for the case where the client does not express a 203 preference, when handling a MultiViews request. The list of 204 <em>MIME-lang</em> are in order of decreasing preference. 205 Example:</p> 206 207 <blockquote> 208 <code>LanguagePriority en fr de</code> 209 </blockquote> 210 For a request for <code>foo.html</code>, where 211 <code>foo.html.fr</code> and <code>foo.html.de</code> both 212 existed, but the browser did not express a language preference, 213 then <code>foo.html.fr</code> would be returned. 214 215 <p>Note that this directive only has an effect if a 'best' 216 language cannot be determined by any other means. Correctly 217 implemented HTTP/1.1 requests will mean this directive has no 218 effect.</p> 219 220 <p><strong>See also</strong>: <a 221 href="./mod_mime.html#defaultlanguage">DefaultLanguage</a> and 222 <a href="./mod_mime.html#addlanguage">AddLanguage</a> 223 <hr /> 224 225 <h3 align="CENTER">Apache HTTP Server Version 1.3</h3> 226 <a href="./"><img src="../images/index.gif" alt="Index" /></a> 227 <a href="../"><img src="../images/home.gif" alt="Home" /></a> 228 229 </p> 230 </body> 231</html> 232 233 234 235