📄 mod_alias.html.en
字号:
with .htaccess files or inside of <Directory> sections.</p> <p>If no <em>status</em> argument is given, the redirect will be "temporary" (HTTP status 302). This indicates to the client that the resource has moved temporarily. The <em>status</em> argument can be used to return other HTTP status codes:</p> <dl> <dt>permanent</dt> <dd>Returns a permanent redirect status (301) indicating that the resource has moved permanently.</dd> <dt>temp</dt> <dd>Returns a temporary redirect status (302). This is the default.</dd> <dt>seeother</dt> <dd>Returns a "See Other" status (303) indicating that the resource has been replaced.</dd> <dt>gone</dt> <dd>Returns a "Gone" status (410) indicating that the resource has been permanently removed. When this status is used the <em>url</em> argument should be omitted.</dd> </dl> <p>Other status codes can be returned by giving the numeric status code as the value of <em>status</em>. If the status is between 300 and 399, the <em>url</em> argument must be present, otherwise it must be omitted. Note that the status must be known to the Apache code (see the function <code>send_error_response</code> in http_protocol.c).</p> <p>Example:</p> <pre> Redirect permanent /one http://example.com/two<br /> Redirect 303 /two http://example.com/other </pre> <hr /> <h2><a id="redirectmatch" name="redirectmatch">RedirectMatch</a></h2> <p><a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> RedirectMatch [<em>status</em>] <em>regex 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> Available in Apache 1.3 and later</p> <p>This directive is equivalent to <a href="#redirect">Redirect</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 redirect all GIF files to like-named JPEG files on another server, one might use:</p><pre> RedirectMatch (.*)\.gif$ http://www.anotherserver.com$1.jpg</pre> <hr /> <h2><a id="redirecttemp" name="redirecttemp">RedirectTemp directive</a></h2> <p> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> RedirectTemp <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> This directive is only available in Apache 1.2 and later</p> <p>This directive makes the client know that the Redirect is only temporary (status 302). Exactly equivalent to <code>Redirect temp</code>.</p> <hr /> <h2><a id="redirectperm" name="redirectperm">RedirectPermanent directive</a></h2> <p> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> RedirectPermanent <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> This directive is only available in Apache 1.2 and later</p> <p>This directive makes the client know that the Redirect is permanent (status 301). Exactly equivalent to <code>Redirect permanent</code>.</p> <hr /> <h2><a id="scriptalias" name="scriptalias">ScriptAlias directive</a></h2> <p> <a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> ScriptAlias <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 ScriptAlias directive has the same behavior as the <a href="#alias">Alias</a> directive, except that in addition it marks the target directory as containing CGI scripts that will be processed by <a href="mod_cgi.html">mod_cgi</a>'s cgi-script handler. URLs with a (%-decoded) path beginning with <em>URL-path</em> will be mapped to scripts beginning with the second argument which is a full pathname in the local filesystem.</p> <p>Example:</p> <blockquote> <code>ScriptAlias /cgi-bin/ /web/cgi-bin/</code> </blockquote> <p>A request for http://myserver/cgi-bin/foo would cause the server to run the script /web/cgi-bin/foo.</p> <hr /> <h2><a id="scriptaliasmatch" name="scriptaliasmatch">ScriptAliasMatch</a></h2> <p><a href="directive-dict.html#Syntax" rel="Help"><strong>Syntax:</strong></a> ScriptAliasMatch <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="#scriptalias">ScriptAlias</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 standard <code>/cgi-bin</code>, one might use:</p><pre> ScriptAliasMatch ^/cgi-bin(.*) /usr/local/apache/cgi-bin$1</pre> <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> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -