⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_mime.html.en

📁 apache 安装教程 apache 安装教程
💻 EN
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">  <head>    <meta name="generator" content="HTML Tidy, see www.w3.org" />    <title>Apache module mod_mime</title>  </head>  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"  vlink="#000080" alink="#FF0000">        <div align="CENTER">      <img src="../images/sub.gif" alt="[APACHE DOCUMENTATION]" />      <h3>Apache HTTP Server Version 1.3</h3>        <p><small><em>Is this the version you want?  For more recent         versions, check our <a href="/docs/">documentation          index</a>.</em></small></p>    </div>    <h1 align="center">Module mod_mime</h1>    <p>This module provides for determining the types of files from    the filename and for association of handlers with files.</p>    <p><a href="module-dict.html#Status"    rel="Help"><strong>Status:</strong></a> Base<br />     <a href="module-dict.html#SourceFile"    rel="Help"><strong>Source File:</strong></a> mod_mime.c<br />     <a href="module-dict.html#ModuleIdentifier"    rel="Help"><strong>Module Identifier:</strong></a>    mime_module</p>    <h2>Summary</h2>    This module is used to determine various bits of "meta    information" about documents. This information relates to the    content of the document and is returned to the browser or used    in content-negotiation within the server. In addition, a    "handler" can be set for a document, which determines how the    document will be processed within the server.     <p>The directives <a href="#addcharset">AddCharset</a>, <a    href="#addencoding">AddEncoding</a>, <a    href="#addhandler">AddHandler</a>, <a    href="#addlanguage">AddLanguage</a> and <a    href="#addtype">AddType</a> are all used to map file extensions    onto the meta-information for that file. Respectively they set    the character set, content-encoding, handler, content-language,    and MIME-type (content-type) of documents. The directive <a    href="#typesconfig">TypesConfig</a> is used to specify a file    which also maps extensions onto MIME types. The directives <a    href="#forcetype">ForceType</a> and <a    href="#sethandler">SetHandler</a> are used to associated all    the files in a given location (<em>e.g.</em>, a particular    directory) onto a particular MIME type or handler.</p>    <p>Note that changing the type or encoding of a file does not    change the value of the <code>Last-Modified</code> header.    Thus, previously cached copies may still be used by a client or    proxy, with the previous headers.</p>    <h2>Directives</h2>    <ul>      <li><a href="#addcharset">AddCharset</a></li>      <li><a href="#addencoding">AddEncoding</a></li>      <li><a href="#addhandler">AddHandler</a></li>      <li><a href="#addlanguage">AddLanguage</a></li>      <li><a href="#addtype">AddType</a></li>      <li><a href="#defaultlanguage">DefaultLanguage</a></li>      <li><a href="#forcetype">ForceType</a></li>      <li><a href="#removeencoding">RemoveEncoding</a></li>      <li><a href="#removehandler">RemoveHandler</a></li>      <li><a href="#removetype">RemoveType</a></li>      <li><a href="#sethandler">SetHandler</a></li>      <li><a href="#typesconfig">TypesConfig</a></li>    </ul>    <p>See also: <a    href="mod_mime_magic.html#mimemagicfile">MimeMagicFile</a>.</p>    <h2><a id="multipleext" name="multipleext">Files with Multiple    Extensions</a></h2>    <p>Files can have more than one extension, and the order of the    extensions is <em>normally</em> irrelevant. For example, if the    file <code>welcome.html.fr</code> maps onto content type    <code>text/html</code> and language French then the file    <code>welcome.fr.html</code> will map onto exactly the same information.    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, except for languages and content encodings. For example, if    <code>.gif</code> maps to the MIME-type <code>image/gif</code> and    <code>.html</code> maps to the MIME-type <code>text/html</code>, then the    file <code>welcome.gif.html</code> will be associated with the MIME-type    <code>text/html</code>.</p>    <p>Languages and content encodings are treated accumulative, because one    can assign more than one language or encoding to a particular resource.    For example, the file <code>welcome.html.en.de</code> will be delivered    with <code>Content-Language: en, de</code> and <code>Content-Type:    text/html</code>.</p>    <p>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 <code>.imap</code>    extension is mapped to the handler "imap-file" (from mod_imap)    and the <code>.html</code> extension is mapped to the MIME-type    "text/html", then the file <code>world.imap.html</code> 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.</p>    <hr />    <h2><a id="addcharset" name="addcharset">AddCharset</a>    directive</h2>    <a href="directive-dict.html#Syntax"    rel="Help"><strong>Syntax:</strong></a> AddCharset <em>charset    extension</em> [<em>extension</em>] ...<br />     <a href="directive-dict.html#Context"    rel="Help"><strong>Context:</strong></a> server config, virtual    host, directory, .htaccess<br />     <a href="directive-dict.html#Override"    rel="Help"><strong>Override:</strong></a> FileInfo<br />     <a href="directive-dict.html#Status"    rel="Help"><strong>Status:</strong></a> Base<br />     <a href="directive-dict.html#Module"    rel="Help"><strong>Module:</strong></a> mod_mime <br />     <a href="directive-dict.html#Compatibility"    rel="Help"><strong>Compatibility:</strong></a> AddCharset is    only available in Apache 1.3.10 and later     <p>The AddCharset directive maps the given filename extensions    to the specified content charset. <i>charset</i> is the MIME    charset parameter of filenames containing <i>extension</i>.    This mapping is added to any already in force, overriding any    mappings that already exist for the same <i>extension</i>.</p>    <p>Example:</p><pre>    AddLanguage ja .ja    AddCharset EUC-JP .euc    AddCharset ISO-2022-JP .jis    AddCharset SHIFT_JIS .sjis</pre>    <p>Then the document <code>xxxx.ja.jis</code> will be treated    as being a Japanese document whose charset is ISO-2022-JP (as    will the document <code>xxxx.jis.ja</code>). The AddCharset    directive is useful for both to inform the client about the    character encoding of the document so that the document can be    interpreted and displayed appropriately, and for <a    href="../content-negotiation.html">content negotiation</a>,    where the server returns one from several documents based on    the client's charset preference.</p>    <p>The <em>extension</em> argument is case-insensitive, and can    be specified with or without a leading dot.</p>    <p><strong>See also</strong>: <a    href="mod_negotiation.html">mod_negotiation</a></p>    <hr />    <h2><a id="addencoding" name="addencoding">AddEncoding</a>    directive</h2>    <!--%plaintext &lt;?INDEX {\tt AddEncoding} directive&gt; -->    <a href="directive-dict.html#Syntax"    rel="Help"><strong>Syntax:</strong></a> AddEncoding    <em>MIME-enc extension</em> [<em>extension</em>] ...<br />     <a href="directive-dict.html#Context"    rel="Help"><strong>Context:</strong></a> server config, virtual    host, directory, .htaccess<br />     <a href="directive-dict.html#Override"    rel="Help"><strong>Override:</strong></a> FileInfo<br />     <a href="directive-dict.html#Status"    rel="Help"><strong>Status:</strong></a> Base<br />     <a href="directive-dict.html#Module"    rel="Help"><strong>Module:</strong></a> mod_mime     <p>The AddEncoding directive maps the given filename extensions    to the specified encoding type. <em>MIME-enc</em> is the MIME    encoding to use for documents containing the    <em>extension</em>. This mapping is added to any already in    force, overriding any mappings that already exist for the same    <em>extension</em>. Example:</p>    <blockquote>      <code>AddEncoding x-gzip .gz<br />       AddEncoding x-compress .Z</code>    </blockquote>    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.     <p>Old clients expect <code>x-gzip</code> and    <code>x-compress</code>, however the standard dictates that    they're equivalent to <code>gzip</code> and    <code>compress</code> respectively. Apache does content    encoding comparisons by ignoring any leading <code>x-</code>.    When responding with an encoding Apache will use whatever form    (<em>i.e.</em>, <code>x-foo</code> or <code>foo</code>) the    client requested. If the client didn't specifically request a    particular form Apache will use the form given by the    <code>AddEncoding</code> directive. To make this long story    short, you should always use <code>x-gzip</code> and    <code>x-compress</code> for these two specific encodings. More    recent encodings, such as <code>deflate</code> should be    specified without the <code>x-</code>.</p>    <p>The <em>extension</em> argument is case-insensitive, and can    be specified with or without a leading dot.</p>    <p><strong>See also</strong>: <a href="#multipleext">Files with    multiple extensions</a></p>    <hr />    <h2><a id="addhandler" name="addhandler">AddHandler</a>    directive</h2>    <a href="directive-dict.html#Syntax"    rel="Help"><strong>Syntax:</strong></a> AddHandler    <em>handler-name extension</em> [<em>extension</em>] ...<br />     <a href="directive-dict.html#Context"    rel="Help"><strong>Context:</strong></a> server config, virtual    host, directory, .htaccess<br />     <a href="directive-dict.html#Override"    rel="Help"><strong>Override:</strong></a> FileInfo<br />     <a href="directive-dict.html#Status"    rel="Help"><strong>Status:</strong></a> Base<br />     <a href="directive-dict.html#Module"    rel="Help"><strong>Module:</strong></a> mod_mime<br />     <a href="directive-dict.html#Compatibility"    rel="Help"><strong>Compatibility:</strong></a> AddHandler is    only available in Apache 1.1 and later     <p>AddHandler maps the filename extensions <em>extension</em>    to the <a href="../handler.html">handler</a>    <em>handler-name</em>. This mapping is added to any already in    force, overriding any mappings that already exist for the same    <em>extension</em>. For example, to activate CGI scripts with    the file extension "<code>.cgi</code>", you might use:</p><pre>    AddHandler cgi-script .cgi</pre>    <p>Once that has been put into your srm.conf or httpd.conf    file, any file containing the "<code>.cgi</code>" extension    will be treated as a CGI program.</p>    <p>The <em>extension</em> argument is case-insensitive, and can    be specified with or without a leading dot.</p>    <p><strong>See also</strong>: <a href="#multipleext">Files with    multiple extensions</a>, <a href="#sethandler">SetHandler</a></p>    <hr />    <h2><a id="addlanguage" name="addlanguage">AddLanguage</a>    directive</h2>    <!--%plaintext &lt;?INDEX {\tt AddLanguage} directive&gt; -->    <a href="directive-dict.html#Syntax"    rel="Help"><strong>Syntax:</strong></a> AddLanguage    <em>MIME-lang extension</em> [<em>extension</em>] ...<br />     <a href="directive-dict.html#Context"    rel="Help"><strong>Context:</strong></a> server config, virtual    host, directory, .htaccess<br />     <a href="directive-dict.html#Override"    rel="Help"><strong>Override:</strong></a> FileInfo<br />     <a href="directive-dict.html#Status"    rel="Help"><strong>Status:</strong></a> Base<br />     <a href="directive-dict.html#Module"    rel="Help"><strong>Module:</strong></a> mod_mime     <p>The AddLanguage directive maps the given filename extension    to the specified content language. <em>MIME-lang</em> is the    MIME language of filenames containing <em>extension</em>. This    mapping is added to any already in force, overriding any    mappings that already exist for the same    <em>extension</em>.</p>    <p>Example:</p>    <blockquote>      <code>AddEncoding x-compress .Z<br />       AddLanguage en .en<br />       AddLanguage fr .fr<br />      </code>    </blockquote>    <p>Then the document <code>xxxx.en.Z</code> will be treated as    being a compressed English document (as will the document    <code>xxxx.Z.en</code>). Although the content language is    reported to the client, the browser is unlikely to use this    information. The AddLanguage directive is more useful for <a    href="../content-negotiation.html">content negotiation</a>,    where the server returns one from several documents based on    the client's language preference.</p>    <p>If multiple language assignments are made for the same    extension, the last one encountered is the one that is used.    That is, for the case of:</p><pre>    AddLanguage en .en    AddLanguage en-gb .en    AddLanguage en-us .en</pre>    <p>documents with the extension "<code>.en</code>" would be    treated as being "<code>en-us</code>".</p>    <p>The <em>extension</em> argument is case-insensitive, and can    be specified with or without a leading dot.</p>    <p><strong>See also</strong>: <a href="#multipleext">Files with    multiple extensions</a>, <a    href="#defaultlanguage">DefaultLanguage</a><br />     <strong>See also</strong>: <a    href="./mod_negotiation.html">mod_negotiation</a></p>    <hr />    <h2><a id="addtype" name="addtype">AddType</a> directive</h2>    <!--%plaintext &lt;?INDEX {\tt AddType} directive&gt; -->    <a href="directive-dict.html#Syntax"    rel="Help"><strong>Syntax:</strong></a> AddType <em>MIME-type    extension</em> [<em>extension</em>] ...<br />     <a href="directive-dict.html#Context"    rel="Help"><strong>Context:</strong></a> server config, virtual    host, directory, .htaccess<br />     <a href="directive-dict.html#Override"    rel="Help"><strong>Override:</strong></a> FileInfo<br />

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -