?? mod_alias.html.en
字號:
<?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_alias - 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="<-" alt="<-" src="../images/left.gif" /></a></div>
<div id="path">
<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.0</a> > <a href="./">Modules</a></div>
<div id="page-content">
<div id="preamble"><h1>Apache Module mod_alias</h1>
<div class="toplang">
<p><span>Available Languages: </span><a href="../en/mod/mod_alias.html" title="English"> en </a> |
<a href="../ja/mod/mod_alias.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="../ko/mod/mod_alias.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
</div>
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides for mapping different parts of the host
filesystem in the document tree and for URL redirection</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>alias_module</td></tr>
<tr><th><a href="module-dict.html#SourceFile">Source燜ile:</a></th><td>mod_alias.c</td></tr></table>
<h3>Summary</h3>
<p>The directives contained in this module allow for manipulation
and control of URLs as requests arrive at the server. The
<code class="directive"><a href="#alias">Alias</a></code> and <code class="directive"><a href="#scriptalias">ScriptAlias</a></code> directives are used to
map between URLs and filesystem paths. This allows for content
which is not directly under the <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> served as part of the web
document tree. The <code class="directive"><a href="#scriptalias">ScriptAlias</a></code> directive has the
additional effect of marking the target directory as containing
only CGI scripts.</p>
<p>The <code class="directive"><a href="#redirect">Redirect</a></code>
directives are used to instruct clients to make a new request with
a different URL. They are often used when a resource has moved to
a new location.</p>
<p><code class="module"><a href="../mod/mod_alias.html">mod_alias</a></code> is designed to handle simple URL
manipulation tasks. For more complicated tasks such as
manipulating the query string, use the tools provided by
<code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>.</p>
</div>
<div id="quickview"><h3 class="directives">Directives</h3>
<ul id="toc">
<li><img alt="" src="../images/down.gif" /> <a href="#alias">Alias</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#aliasmatch">AliasMatch</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#redirect">Redirect</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#redirectmatch">RedirectMatch</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#redirectpermanent">RedirectPermanent</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#redirecttemp">RedirectTemp</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#scriptalias">ScriptAlias</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#scriptaliasmatch">ScriptAliasMatch</a></li>
</ul>
<h3>Topics</h3>
<ul id="topics">
<li><img alt="" src="../images/down.gif" /> <a href="#order">Order of Processing</a></li>
</ul><h3>See also</h3>
<ul class="seealso">
<li><code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code></li>
<li><a href="../urlmapping.html">Mapping URLs to the filesystem</a></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="order" id="order">Order of Processing</a></h2>
<p>Aliases and Redirects occuring in different contexts are processed
like other directives according to standard <a href="../sections.html#mergin">merging rules</a>. But when multiple
Aliases or Redirects occur in the same context (for example, in the
same <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>
section) they are processed in a particular order.</p>
<p>First, all Redirects are processed before Aliases are processed,
and therefore a request that matches a <code class="directive"><a href="#redirect">Redirect</a></code> or <code class="directive"><a href="#redirectmatch">RedirectMatch</a></code> will never have Aliases
applied. Second, the Aliases and Redirects are processed in the order
they appear in the configuration files, with the first match taking
precedence.</p>
<p>For this reason, when two or more of these directives apply to the
same sub-path, you must list the most specific path first in order for
all the directives to have an effect. For example, the following
configuration will work as expected:</p>
<div class="example"><p><code>
Alias /foo/bar /baz<br />
Alias /foo /gaq
</code></p></div>
<p>But if the above two directives were reversed in order, the
<code>/foo</code> <code class="directive"><a href="#alias">Alias</a></code>
would always match before the <code>/foo/bar</code> <code class="directive"><a href="#alias">Alias</a></code>, so the latter directive would be
ignored.</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="Alias" id="Alias">Alias</a> <a name="alias" id="alias">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps URLs to filesystem locations</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Alias <var>URL-path</var>
<var>file-path</var>|<var>directory-path</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_alias</td></tr>
</table>
<p>The <code class="directive">Alias</code> directive allows documents to
be stored in the local filesystem other than under the
<code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>. URLs with a
(%-decoded) path beginning with <var>url-path</var> will be mapped
to local files beginning with <var>directory-path</var>.</p>
<div class="example"><h3>Example:</h3><p><code>
Alias /image /ftp/pub/image
</code></p></div>
<p>A request for http://myserver/image/foo.gif would cause the
server to return the file /ftp/pub/image/foo.gif.</p>
<p>Note that if you include a trailing / on the
<var>url-path</var> then the server will require a trailing / in
order to expand the alias. That is, if you use <code>Alias
/icons/ /usr/local/apache/icons/</code> then the url
<code>/icons</code> will not be aliased.</p>
<p>Note that you may need to specify additional <code class="directive"><a href="../mod/core.html#directory"><Directory></a></code> sections which
cover the <em>destination</em> of aliases. Aliasing occurs before
<code class="directive"><a href="../mod/core.html#directory"><Directory></a></code> sections
are checked, so only the destination of aliases are affected.
(Note however <code class="directive"><a href="../mod/core.html#location"><Location></a></code>
sections are run through once before aliases are performed, so
they will apply.)</p>
<p>In particular, if you are creating an <code>Alias</code> to a
directory outside of your <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>, you may need to explicitly
permit access to the target directory.</p>
<div class="example"><h3>Example:</h3><p><code>
Alias /image /ftp/pub/image<br />
<Directory /ftp/pub/image><br />
<span class="indent">
Order allow,deny<br />
Allow from all<br />
</span>
</Directory>
</code></p></div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="AliasMatch" id="AliasMatch">AliasMatch</a> <a name="aliasmatch" id="aliasmatch">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps URLs to filesystem locations using regular
expressions</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AliasMatch <var>regex</var>
<var>file-path</var>|<var>directory-path</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_alias</td></tr>
</table>
<p>This directive is equivalent to <code class="directive"><a href="#alias">Alias</a></code>, but makes use of standard
regular expressions, instead of simple prefix matching. The
supplied regular expression is matched against the URL-path, and
if it matches, the server will substitute any parenthesized
matches into the given string and use it as a filename. For
example, to activate the <code>/icons</code> directory, one might
use:</p>
<div class="example"><p><code>
AliasMatch ^/icons(.*) /usr/local/apache/icons$1
</code></p></div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="Redirect" id="Redirect">Redirect</a> <a name="redirect" id="redirect">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sends an external redirect asking the client to fetch
a different URL</td></tr>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -