]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_alias.html
0984bf82e14262102957df1edce1b8e8a6a32d76
[apache] / docs / manual / mod / mod_alias.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>Apache module mod_alias</TITLE>
5 </HEAD>
6
7 <BODY>
8 <!--#include virtual="header.html" -->
9
10 <H1>Module mod_alias</h1>
11
12 This module is contained in the <code>mod_alias.c</code> file, and
13 is compiled in by default. It provides for mapping different parts of the
14 host filesystem in the the document tree, and for URL redirection.
15
16
17 <menu>
18 <li><A HREF="#alias">Alias</A>
19 <li><A HREF="#redirect">Redirect</A>
20 <li><A HREF="#redirecttemp">RedirectTemp</A>
21 <li><A HREF="#redirectperm">RedirectPermanent</A>
22 <li><A HREF="#scriptalias">ScriptAlias</A>
23 </menu>
24 <hr>
25
26
27 <A name="alias"><h2>Alias</h2></A>
28 <!--%plaintext &lt;?INDEX {\tt Alias} directive&gt; -->
29 <strong>Syntax:</strong> Alias <em>url-path directory-filename</em><br>
30 <Strong>Context:</strong> server config, virtual host<br>
31 <strong>Status:</strong> Base<br>
32 <strong>Module:</strong> mod_alias<br>
33
34 The Alias directive allows documents to be stored in the local filesystem
35 other than under the <A HREF="core.html#documentroot">DocumentRoot</A>.
36 URLs with a (%-decoded) path beginning with <em>url-path</em> will be
37 mapped to local files beginning with <em>directory-filename</em>.
38 Example:
39 <blockquote><code>Alias /image /ftp/pub/image</code></blockquote>
40 A request for http://myserver/image/foo.gif would cause the server to
41 return the file /ftp/pub/image/foo.gif.<p>
42 See also <A HREF="#scriptalias">ScriptAlias</A>.<p><hr>
43
44 <A name="redirect"><h2>Redirect</h2></A>
45 <!--%plaintext &lt;?INDEX {\tt Redirect} directive&gt; -->
46 <strong>Syntax:</strong> Redirect [ <em>status</em> ] <em>url-path url</em><br>
47 <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
48 <strong>Status:</strong> Base<br>
49 <strong>Module:</strong> mod_alias<br>
50 <strong>Compatibility:</strong> The directory and .htaccess context's
51 are only available in versions 1.1 and later. The <em>status</em> argument is only available in Apache 1.2 or later.<p>
52
53 The Redirect directive maps an old URL into a new one. The new URL is returned
54 to the client which attempts to fetch it again with the new address.
55 <em>Url-path</em> a (%-decoded) path; any requests for documents beginning with
56 this path will be returned a redirect error to a new (%-encoded) url
57 beginning with <em>url</em>. Example:
58 <blockquote><code>Redirect /service
59 http://foo2.bar.com/service</code></blockquote>
60 If the client requests http://myserver/service/foo.txt, it will be told to
61 access http://foo2.bar.com/service/foo.txt instead.<p>
62 Note: Redirect directives take precedence over Alias and ScriptAlias
63 directives, irrespective of their ordering in the configuration file.<p>
64
65 If no <em>status</em> argument is given, the redirect will be
66 "temporary" (HTTP status 302). This indicates to the client that the
67 resources is has moved temporarily. The <em>status</em>
68 argument can be used to return other HTTP status codes:
69 <dl>
70 <dt>permanent<dd>Returns a permanent redirect status (301) indicating that
71 the resource has moved permanently.
72 <dt>temp<dd>Returns a temporary redirect status (302). This is the
73 default.
74 <dt>seeother<dd>Returns a "See Other" status (303) indicating that
75 the resource has been replaced.
76 <dt>gone<dd>Returns a "Gone" status (410) indicating that the resource
77 has been permanently removed. When this status is used the <em>url</em>
78 argument should be omitted.
79 </dl>
80
81 Other status codes can be returned by giving the numeric status code
82 as the value of <em>status</em>. If the status is between 300 and 399,
83 the <em>url</em> argument must be present, otherwise it must be
84 omitted. Note that the status must be known to the Apache code (see
85 the function <code>send_error_response</code> in http_protocol.c).
86
87 <A name="redirecttemp"><h2>RedirectTemp</h2></A>
88 <!--%plaintext &lt;?INDEX {\tt Redirect} directive&gt; -->
89 <strong>Syntax:</strong> RedirectTemp <em>url-path url</em><br>
90 <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
91 <strong>Status:</strong> Base<br>
92 <strong>Module:</strong> mod_alias<br>
93 <strong>Compatibility:</strong> This directive is only available in 1.2<P>
94
95 This directive makes the client know that the Redirect is only
96 temporary. (Status 302). Exactly equivalent to <code>Redirect temporary </code><P>
97
98 <A name="redirectperm"><h2>RedirectPermanent</h2></A>
99 <!--%plaintext &lt;?INDEX {\tt Redirect} directive&gt; -->
100 <strong>Syntax:</strong> RedirectPermanent <em>url-path url</em><br>
101 <Strong>Context:</strong> server config, virtual host, directory, .htaccess<br>
102 <strong>Status:</strong> Base<br>
103 <strong>Module:</strong> mod_alias<br>
104 <strong>Compatibility:</strong> This directive is only available in 1.2<P>
105
106 This directive makes the client know that the Redirect is permanent.
107 (Status 301). Exactly equivalent to <code>Redirect perm </code><P>
108
109 <hr>
110 <A name="scriptalias"><h2>ScriptAlias</h2></A>
111 <!--%plaintext &lt;?INDEX {\tt ScriptAlias} directive&gt; -->
112 <strong>Syntax:</strong> ScriptAlias <em>url-path directory-filename</em><br>
113 <Strong>Context:</strong> server config, virtual host<br>
114 <strong>Status:</strong> Base<br>
115 <strong>Module:</strong> mod_alias<br>
116
117 The ScriptAlias directive has the same behaviour as the
118 <A HREF="#alias">Alias</A> directive, except that in addition it
119 marks the target directory as containing CGI scripts.
120 URLs with a (%-decoded) path beginning with <em>url-path</em> will be
121 mapped to scripts beginning with <em>directory-filename</em>.
122 Example:
123 <blockquote><code>ScriptAlias /cgi-bin/ /web/cgi-bin/</code></blockquote>
124 A request for http://myserver/cgi-bin/foo would cause the server to
125 run the script /web/cgi-bin/foo.<p>
126
127 <!--#include virtual="footer.html" -->
128 </BODY>
129 </HTML>
130