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