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

📄 mod_mime.html.en

📁 Apache_2.0.59-Openssl_0.9 配置tomcat. Apache_2.0.59-Openssl_0.9 配置tomcat.
💻 EN
📖 第 1 页 / 共 4 页
字号:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
              This file is generated from xml source: DO NOT EDIT
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      -->
<title>mod_mime - Apache HTTP Server</title>
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
<link href="../images/favicon.ico" rel="shortcut icon" /></head>
<body>
<div id="page-header">
<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>
<p class="apache">Apache HTTP Server Version 2.0</p>
<img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
<div id="path">
<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.0</a> &gt; <a href="./">Modules</a></div>
<div id="page-content">
<div id="preamble"><h1>Apache Module mod_mime</h1>
<div class="toplang">
<p><span>Available Languages: </span><a href="../en/mod/mod_mime.html" title="English">&nbsp;en&nbsp;</a> |
<a href="../ja/mod/mod_mime.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
</div>
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Associates the requested filename's extensions
    with the file's behavior (handlers and filters)
    and content (mime-type, language, character set and
    encoding)</td></tr>
<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
<tr><th><a href="module-dict.html#ModuleIdentifier">Module營dentifier:</a></th><td>mime_module</td></tr>
<tr><th><a href="module-dict.html#SourceFile">Source燜ile:</a></th><td>mod_mime.c</td></tr></table>
<h3>Summary</h3>

    <p>This module is used to associate various bits of "meta
    information" with files by their filename extensions. This
    information relates the filename of the document to it's
    mime-type, language, character set and encoding. This
    information is sent to the browser, and participates in content
    negotiation, so the user's preferences are respected when
    choosing one of several possible files to serve. See
    <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code> for more information
    about <a href="../content-negotiation.html">content negotiation</a>.</p>

    <p>The directives <code class="directive"><a href="#addcharset">AddCharset</a></code>, <code class="directive"><a href="#addencoding">AddEncoding</a></code>, <code class="directive"><a href="#addlanguage">AddLanguage</a></code> and <code class="directive"><a href="#addtype">AddType</a></code> are all used to map file
    extensions onto the meta-information for that file. Respectively
    they set the character set, content-encoding, content-language,
    and MIME-type (content-type) of documents.  The directive <code class="directive"><a href="#typesconfig">TypesConfig</a></code> is used to specify a
    file which also maps extensions onto MIME types. </p>

    <p>In addition, <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> may define the <a href="../handler.html">handler</a> and <a href="../filter.html">filters</a> that originate and process
    content.  The directives <code class="directive"><a href="#addhandler">AddHandler</a></code>, <code class="directive"><a href="#addoutputfilter">AddOutputFilter</a></code>, and <code class="directive"><a href="#addinputfilter">AddInputFilter</a></code> control the modules
    or scripts that serve the document.  The <code class="directive"><a href="#multiviewsmatch">MultiviewsMatch</a></code> directive allows
    <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code> to consider these file extensions
    to be included when testing Multiviews matches.</p>

    <p>While <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> associates meta-information
    with filename extensions, the <code class="module"><a href="../mod/core.html">core</a></code> server
    provides directives that are used to associate all the files in a
    given container (<em>e.g.</em>, <code class="directive"><a href="../mod/core.html#location">&lt;Location&gt;</a></code>, <code class="directive"><a href="../mod/core.html#directory">&lt;Directory&gt;</a></code>, or <code class="directive"><a href="../mod/core.html#files">&lt;Files&gt;</a></code>) with particular
    meta-information. These directives include <code class="directive"><a href="../mod/core.html#forcetype">ForceType</a></code>, <code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code>, <code class="directive"><a href="../mod/core.html#setinputfilter">SetInputFilter</a></code>, and <code class="directive"><a href="../mod/core.html#setoutputfilter">SetOutputFilter</a></code>.  The core directives
    override any filename extension mappings defined in
    <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code>.</p>

    <p>Note that changing the meta-information for 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. If you change the
    meta-information (language, content type, character set or
    encoding) you may need to 'touch' affected files (updating
    their last modified date) to ensure that all visitors are
    receive the corrected content headers.</p>
</div>
<div id="quickview"><h3 class="directives">Directives</h3>
<ul id="toc">
<li><img alt="" src="../images/down.gif" /> <a href="#addcharset">AddCharset</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#addencoding">AddEncoding</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#addhandler">AddHandler</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#addinputfilter">AddInputFilter</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#addlanguage">AddLanguage</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#addoutputfilter">AddOutputFilter</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#addtype">AddType</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#defaultlanguage">DefaultLanguage</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#modmimeusepathinfo">ModMimeUsePathInfo</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#multiviewsmatch">MultiviewsMatch</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#removecharset">RemoveCharset</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#removeencoding">RemoveEncoding</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#removehandler">RemoveHandler</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#removeinputfilter">RemoveInputFilter</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#removelanguage">RemoveLanguage</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#removeoutputfilter">RemoveOutputFilter</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#removetype">RemoveType</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#typesconfig">TypesConfig</a></li>
</ul>
<h3>Topics</h3>
<ul id="topics">
<li><img alt="" src="../images/down.gif" /> <a href="#multipleext">Files with Multiple Extensions</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#contentencoding">Content encoding</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#charset-lang">Character sets and languages</a></li>
</ul><h3>See also</h3>
<ul class="seealso">
<li><code class="directive"><a href="../mod/mod_mime_magic.html#mimemagicfile">MimeMagicFile</a></code></li>
<li><code class="directive"><a href="../mod/core.html#adddefaultcharset">AddDefaultCharset</a></code></li>
<li><code class="directive"><a href="../mod/core.html#forcetype">ForceType</a></code></li>
<li><code class="directive"><a href="../mod/core.html#defaulttype">DefaultType</a></code></li>
<li><code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code></li>
<li><code class="directive"><a href="../mod/core.html#setinputfilter">SetInputFilter</a></code></li>
<li><code class="directive"><a href="../mod/core.html#setoutputfilter">SetOutputFilter</a></code></li>
</ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="multipleext" id="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><a href="#charset-lang">Languages</a> and <a href="#contentencoding">content encodings</a> 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 <code>imap-file</code> (from
    <code class="module"><a href="../mod/mod_imap.html">mod_imap</a></code>) and the <code>.html</code> extension is
    mapped to the MIME-type <code>text/html</code>, then the file
    <code>world.imap.html</code> will be associated with both the
    <code>imap-file</code> handler and <code>text/html</code> MIME-type.
    When it is processed, the <code>imap-file</code> handler will be used,
    and so it will be treated as a <code class="module"><a href="../mod/mod_imap.html">mod_imap</a></code> imagemap
    file.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="contentencoding" id="contentencoding">Content encoding</a></h2>
    <p>A file of a particular MIME type can additionally be encoded a
    particular way to simplify transmission over the Internet.
    While this usually will refer to compression, such as
    <code>gzip</code>, it can also refer to encryption, such a
    <code>pgp</code> or to an encoding such as UUencoding, which is
    designed for transmitting a binary file in an ASCII (text)
    format.</p>

    <p>The <a href="http://www.ietf.org/rfc/rfc2616.txt">HTTP/1.1
    RFC</a>, section 14.11 puts it this way:</p>

    <blockquote cite="http://www.ietf.org/rfc/rfc2616.txt">
      <p>The Content-Encoding entity-header field is used as a modifier to
      the media-type. When present, its value indicates what additional
      content codings have been applied to the entity-body, and thus what
      decoding mechanisms must be applied in order to obtain the media-type
      referenced by the Content-Type header field. Content-Encoding is
      primarily used to allow a document to be compressed without losing
      the identity of its underlying media type.</p>
    </blockquote>

    <p>By using more than one file extension (see <a href="#multipleext">section above about multiple file
    extensions</a>), you can indicate that a file is of a
    particular <em>type</em>, and also has a particular
    <em>encoding</em>. </p>

    <p>For example, you may have a file which is a Microsoft Word
    document, which is pkzipped to reduce its size. If the
    <code>.doc</code> extension is associated with the Microsoft
    Word file type, and the <code>.zip</code> extension is
    associated with the pkzip file encoding, then the file
    <code>Resume.doc.zip</code> would be known to be a pkzip'ed Word
    document.</p>

    <p>Apache sends a <code>Content-encoding</code> header with the
    resource, in order to tell the client browser about the
    encoding method.</p>

    <div class="example"><p><code>Content-encoding: pkzip</code></p></div>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="charset-lang" id="charset-lang">Character sets and languages</a></h2>
    <p>In addition to file type and the file encoding,
    another important piece of information is what language a
    particular document is in, and in what character set the file
    should be displayed. For example, the document might be written
    in the Vietnamese alphabet, or in Cyrillic, and should be
    displayed as such. This information, also, is transmitted in
    HTTP headers.</p>

    <p>The character set, language, encoding and mime type are all 
    used in the process of content negotiation (See 
    <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>) to determine
    which document to give to the client, when there are
    alternative documents in more than one character set, language, 
    encoding or mime type. All filename extensions associations
    created with <code class="directive"><a href="#addcharset">AddCharset</a></code>,
    <code class="directive"><a href="#addencoding">AddEncoding</a></code>, <code class="directive"><a href="#addlanguage">AddLanguage</a></code> and <code class="directive"><a href="#addtype">AddType</a></code> directives
    (and extensions listed in the <code class="directive"><a href="../mod/mod_mime_magic.html#mimemagicfile">MimeMagicFile</a></code>) participate in this select process.
    Filename extensions that are only associated using the <code class="directive"><a href="#addhandler">AddHandler</a></code>, <code class="directive"><a href="#addinputfilter">AddInputFilter</a></code> or <code class="directive"><a href="#addoutputfilter">AddOutputFilter</a></code> directives may be included or excluded
    from matching by using the <code class="directive"><a href="#multiviewsmatch">MultiviewsMatch</a></code> directive.</p>

    <h3><a name="charset" id="charset">Charset</a></h3>
      <p>To convey this further information, Apache optionally sends
      a <code>Content-Language</code> header, to specify the language
      that the document is in, and can append additional information
      onto the <code>Content-Type</code> header to indicate the
      particular character set that should be used to correctly
      render the information.</p>

      <div class="example"><p><code>
        Content-Language: en, fr<br />
	Content-Type: text/plain; charset=ISO-8859-1
      </code></p></div>

      <p>The language specification is the two-letter abbreviation
      for the language. The <code>charset</code> is the name of the
      particular character set which should be used.</p>
    
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="AddCharset" id="AddCharset">AddCharset</a> <a name="addcharset" id="addcharset">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps the given filename extensions to the specified content
charset</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddCharset <var>charset</var> <var>extension</var>
[<var>extension</var>] ...</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>

⌨️ 快捷键说明

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