📄 mod_alias.html.en
字号:
<!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_alias</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_alias</h1> <p>This module provides for mapping different parts of the host filesystem in the document tree, and for URL redirection.</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_alias.c<br /> <a href="module-dict.html#ModuleIdentifier" rel="Help"><strong>Module Identifier:</strong></a> alias_module</p> <h2>Summary</h2> <p>The directives contained in this module allow for manipulation and control of URLs as requests arrive at the server. The <code>Alias</code> and <code>ScriptAlias</code> directives are used to map between URLs and filesystem paths. This allows for content which is not directly under the <a href="core.html#documentroot"><code>DocumentRoot</code></a> to be served as part of the web document tree. The <code>ScriptAlias</code> directive has the additional effect of marking the target directory as containing only CGI scripts.</p> <p>The <code>Redirect</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>A more powerful and flexible set of directives for manipulating URLs is contained in the <a href="mod_rewrite.html"><code>mod_rewrite</code></a> module.</p> <h2>Directives</h2> <ul> <li><a href="#alias">Alias</a></li> <li><a href="#aliasmatch">AliasMatch</a></li> <li><a href="#redirect">Redirect</a></li> <li><a href="#redirectmatch">RedirectMatch</a></li> <li><a href="#redirecttemp">RedirectTemp</a></li> <li><a href="#redirectperm">RedirectPermanent</a></li> <li><a href="#scriptalias">ScriptAlias</a></li> <li><a href="#scriptaliasmatch">ScriptAliasMatch</a></li> </ul> <hr /> <h2><a id="alias" name="alias">Alias directive</a></h2> <p> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> Alias <em>URL-path file-path</em>|<em>directory-path</em><br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> server config, virtual host<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_alias</p> <p>The Alias directive allows documents to be stored in the local filesystem other than under the <a href="core.html#documentroot">DocumentRoot</a>. URLs with a (%-decoded) path beginning with <em>url-path</em> will be mapped to local files beginning with <em>directory-filename</em>.</p> <p>Example:</p> <blockquote> <code>Alias /image /ftp/pub/image</code> </blockquote> <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 <em>url-path</em> 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 <a href="core.html#directory"><code><Directory></code></a> sections which cover the <em>destination</em> of aliases. Aliasing occurs before <code><Directory></code> sections are checked, so only the destination of aliases are affected. (Note however <a href="core.html#location"><code><Location></code></a> sections are run through once before aliases are performed, so they will apply.)</p> <p>See also <a href="#scriptalias">ScriptAlias</a>.</p> <hr /> <h2><a id="aliasmatch" name="aliasmatch">AliasMatch</a></h2> <p><a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> AliasMatch <em>regex file-path</em>|<em>directory-path</em><br /> <a href="directive-dict.html#Context" rel="Help"><strong>Context:</strong></a> server config, virtual host<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_alias<br /> <a href="directive-dict.html#Compatibility" rel="Help"><strong>Compatibility:</strong></a> Available in Apache 1.3 and later</p> <p>This directive is equivalent to <a href="#alias">Alias</a>, 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><pre> AliasMatch ^/icons(.*) /usr/local/apache/icons$1</pre> <hr /> <h2><a id="redirect" name="redirect">Redirect directive</a></h2> <p> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> Redirect [<em>status</em>] <em>URL-path URL</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_alias<br /> <a href="directive-dict.html#Compatibility" rel="Help"><strong>Compatibility:</strong></a> The directory and .htaccess context's are only available in versions 1.1 and later. The <em>status</em> argument is only available in Apache 1.2 or later.</p> <p>The Redirect directive maps an old URL into a new one. The new URL is returned to the client which attempts to fetch it again with the new address. <em>URL-path</em> a (%-decoded) path; any requests for documents beginning with this path will be returned a redirect error to a new (%-encoded) URL beginning with <em>URL</em>.</p> <p>Example:</p> <blockquote> <code>Redirect /service http://foo2.bar.com/service</code> </blockquote> <p>If the client requests http://myserver/service/foo.txt, it will be told to access http://foo2.bar.com/service/foo.txt instead.</p> <p><strong>Note:</strong> Redirect directives take precedence over Alias and ScriptAlias directives, irrespective of their ordering in the configuration file. Also, <em>URL-path</em> must be a fully qualified URL, not a relative path, even when used
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -