📄 mod_mime.html.en
字号:
<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 AddType directive maps the given filename extensions onto the specified content type. <em>MIME-type</em> is the MIME type to use for 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>. This directive can be used to add mappings not listed in the MIME types file (see the <code><a href="#typesconfig">TypesConfig</a></code> directive). Example:</p> <blockquote> <code>AddType image/gif .gif</code> </blockquote> It is recommended that new MIME types be added using the AddType directive rather than changing the <a href="#typesconfig">TypesConfig</a> file. <p>Note that, unlike the NCSA httpd, this directive cannot be used to set the type of particular files.</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="defaultlanguage" name="defaultlanguage">DefaultLanguage</a> directive</h2> <!--%plaintext <?INDEX {\tt DefaultLanguage} directive> --> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> DefaultLanguage <em>MIME-lang</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> DefaultLanguage is only available in Apache 1.3.4 and later. <p>The DefaultLanguage directive tells Apache that all files in the directive's scope (<em>e.g.</em>, all files covered by the current <code><Directory></code> container) that don't have an explicit language extension (such as <samp>.fr</samp> or <samp>.de</samp> as configured by <samp>AddLanguage</samp>) should be considered to be in the specified <em>MIME-lang</em> language. This allows entire directories to be marked as containing Dutch content, for instance, without having to rename each file. Note that unlike using extensions to specify languages, <samp>DefaultLanguage</samp> can only specify a single language.</p> <p>For example:</p> <code>DefaultLanguage fr</code> <p>If no <samp>DefaultLanguage</samp> directive is in force, and a file does not have any language extensions as configured by <samp>AddLanguage</samp>, then that file will be considered to have no language attribute.</p> <p><strong>See also</strong>: <a href="./mod_negotiation.html">mod_negotiation</a><br /> <strong>See also</strong>: <a href="#multipleext">Files with multiple extensions</a></p> <hr /> <h2><a id="forcetype" name="forcetype">ForceType</a> directive</h2> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> ForceType <em>media-type</em>|None<br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> directory, .htaccess<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> ForceType is only available in Apache 1.1 and later. <p>When placed into an <code>.htaccess</code> file or a <code><Directory></code> or <code><Location></code> section, this directive forces all matching files to be served as the content type given by <em>media type</em>. For example, if you had a directory full of GIF files, but did not want to label them all with ".gif", you might want to use:</p><pre> ForceType image/gif</pre> <p>Note that this will override any filename extensions that might determine the media type.</p> <p>You can override any <directive>ForceType</directive> setting by using the value of <code>none</code>:</p><pre> # force all files to be image/gif: <Location /images> ForceType image/gif </Location> # but normal mime-type associations here: <Location /images/mixed> ForceType none </Location></pre> <p><strong>See also</strong>: <a href="#addtype">AddType</a></p> <hr /> <h2><a id="removeencoding" name="removeencoding">RemoveEncoding</a> directive</h2> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> RemoveEncoding <em>extension</em> [<em>extension</em>] ...<br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> virtual host, directory, .htaccess<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> RemoveEncoding is only available in Apache 1.3.13 and later. <p>The <samp>RemoveEncoding</samp> directive removes any encoding associations for files with the given extensions. This allows <code>.htaccess</code> files in subdirectories to undo any associations inherited from parent directories or the server config files. An example of its use might be:</p> <dl> <dt><code>/foo/.htaccess:</code></dt> <dd><code>AddEncoding x-gzip .gz</code><br /> <code>AddType text/plain .asc</code><br /> <code><Files *.gz.asc></code><br /> <code> RemoveEncoding .gz</code><br /> <code></Files></code></dd> </dl> <p>This will cause <code>foo.gz</code> to mark as being encoded with the gzip method, but <code>foo.gz.asc</code> as an unencoded plaintext file.</p> <p><b>Note:</b>RemoveEncoding directives are processed <i>after</i> any <a href="#addencoding">AddEncoding</a> directives, so it is possible they may undo the effects of the latter if both occur within the same directory configuration.</p> <p>The <em>extension</em> argument is case-insensitive, and can be specified with or without a leading dot.</p> <hr /> <h2><a id="removehandler" name="removehandler">RemoveHandler</a> directive</h2> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> RemoveHandler <em>extension</em> [<em>extension</em>] ...<br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> virtual host, directory, .htaccess<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> RemoveHandler is only available in Apache 1.3.4 and later. <p>The <samp>RemoveHandler</samp> directive removes any handler associations for files with the given extensions. This allows <code>.htaccess</code> files in subdirectories to undo any associations inherited from parent directories or the server config files. An example of its use might be:</p> <dl> <dt><code>/foo/.htaccess:</code></dt> <dd><code>AddHandler server-parsed .html</code></dd> <dt><code>/foo/bar/.htaccess:</code></dt> <dd><code>RemoveHandler .html</code></dd> </dl> <p>This has the effect of returning <samp>.html</samp> files in the <samp>/foo/bar</samp> directory to being treated as normal files, rather than as candidates for parsing (see the <a href="mod_include.html"><samp>mod_include</samp></a> module).</p> <p>The <em>extension</em> argument is case-insensitive, and can be specified with or without a leading dot.</p> <hr /> <h2><a id="removetype" name="removetype">RemoveType</a> directive</h2> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> RemoveType <em>extension</em> [<em>extension</em>] ...<br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> virtual host, directory, .htaccess<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> RemoveType is only available in Apache 1.3.13 and later. <p>The <samp>RemoveType</samp> directive removes any MIME type associations for files with the given extensions. This allows <code>.htaccess</code> files in subdirectories to undo any associations inherited from parent directories or the server config files. An example of its use might be:</p> <dl> <dt><code>/foo/.htaccess:</code></dt> <dd><code>RemoveType .cgi</code></dd> </dl> <p>This will remove any special handling of <code>.cgi</code> files in the <code>/foo/</code> directory and any beneath it, causing the files to be treated as being of the <a href="core.html#defaulttype">default type</a>.</p> <p><b>Note:</b><code>RemoveType</code> directives are processed <i>after</i> any <code>AddType</code> directives, so it is possible they may undo the effects of the latter if both occur within the same directory configuration.</p> <p>The <em>extension</em> argument is case-insensitive, and can be specified with or without a leading dot.</p> <hr /> <h2><a id="sethandler" name="sethandler">SetHandler</a> directive</h2> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> SetHandler <em>handler-name</em>|None<br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> directory, .htaccess<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> SetHandler is only available in Apache 1.1 and later. <p>When placed into an <code>.htaccess</code> file or a <code><Directory></code> or <code><Location></code> section, this directive forces all matching files to be parsed through the <a href="../handler.html">handler</a> given by <em>handler-name</em>. For example, if you had a directory you wanted to be parsed entirely as imagemap rule files, regardless of extension, you might put the following into an <code>.htaccess</code> file in that directory:</p><pre> SetHandler imap-file</pre> <p>Another example: if you wanted to have the server display a status report whenever a URL of <code>http://servername/status</code> was called, you might put the following into access.conf: (See <a href="mod_status.html">mod_status</a> for more details.)</p><pre> <Location /status> SetHandler server-status </Location></pre> <p>You can override an earlier defined <code>SetHandler</code> directive by using the value <code>None</code>.</p> <p><strong>See also</strong>: <a href="#addhandler">AddHandler</a></p> <hr /> <h2><a id="typesconfig" name="typesconfig">TypesConfig</a> directive</h2> <!--%plaintext <?INDEX {\tt TypesConfig} directive> --> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> TypesConfig <em>file-path</em><br /> <a href="directive-dict.html#Default" rel="Help"><strong>Default:</strong></a> <code>TypesConfig conf/mime.types</code><br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> server config<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 TypesConfig directive sets the location of the MIME types configuration file. <em>Filename</em> is relative to the <a href="core.html#serverroot">ServerRoot</a>. This file sets the default list of mappings from filename extensions to content types; changing this file is not recommended. Use the <a href="#addtype">AddType</a> directive instead. The file contains lines in the format of the arguments to an AddType command:</p> <blockquote> <em>MIME-type extension extension ...</em> </blockquote> The extensions are lower-cased. Blank lines, and lines beginning with a hash character (`#') are ignored. <p> <hr /> <h3 align="CENTER">Apache HTTP Server Version 1.3</h3> <a href="./"><img src="../images/index.gif" alt="Index" /></a> <a href="../"><img src="../images/home.gif" alt="Home" /></a> </p> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -