118
118
be stored in the local filesystem other than under the
119
119
<code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code>. URLs with a
120
120
(%-decoded) path beginning with <var>url-path</var> will be mapped
121
to local files beginning with <var>directory-path</var>.</p>
121
to local files beginning with <var>directory-path</var>. The
122
<var>url-path</var> is case-sensitive, even on case-insenitive
123
125
<div class="example"><h3>Example:</h3><p><code>
124
126
Alias /image /ftp/pub/image
184
186
AliasMatch ^/icons(.*) /usr/local/apache/icons$1
185
187
</code></p></div>
189
<p>It is also possible to construct an alias with case-insensitive
190
matching of the url-path:</p>
192
<div class="example"><p><code>
193
AliasMatch (?i)^/image(.*) /ftp/pub/image$1
188
198
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
189
199
<div class="directive-section"><h2><a name="Redirect" id="Redirect">Redirect</a> <a name="redirect" id="redirect">Directive</a></h2>
200
210
<p>The Redirect directive maps an old URL into a new one by asking
201
211
the client to refetch the resource at the new location.</p>
203
<p>The old <em>URL-path</em> is a (%-decoded) path beginning with
204
a slash. A relative path is not allowed. The new <em>URL</em>
205
should be an absolute URL beginning with a scheme and hostname,
206
but a URL-path beginning with a slash may also be used, in which
207
case the scheme and hostname of the current server will be
213
<p>The old <em>URL-path</em> is a case-sensitive (%-decoded) path
214
beginning with a slash. A relative path is not allowed. The new
215
<em>URL</em> should be an absolute URL beginning with a scheme and
216
hostname, but a URL-path beginning with a slash may also be used,
217
in which case the scheme and hostname of the current server will
210
220
<p>Then any request beginning with <em>URL-Path</em> will return a
211
221
redirect request to the client at the location of the target
342
352
<p>The <code class="directive">ScriptAlias</code> directive has the same
343
353
behavior as the <code class="directive"><a href="#alias">Alias</a></code>
344
354
directive, except that in addition it marks the target directory
345
as containing CGI scripts that will be processed by <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>'s cgi-script handler. URLs with a
355
as containing CGI scripts that will be processed by <code class="module"><a href="../mod/mod_cgi.html">mod_cgi</a></code>'s cgi-script handler. URLs with a case-sensitive
346
356
(%-decoded) path beginning with <var>URL-path</var> will be mapped
347
to scripts beginning with the second argument which is a full
357
to scripts beginning with the second argument, which is a full
348
358
pathname in the local filesystem.</p>
350
360
<div class="example"><h3>Example:</h3><p><code>
352
362
</code></p></div>
354
364
<p>A request for <code>http://myserver/cgi-bin/foo</code> would cause the
355
server to run the script <code>/web/cgi-bin/foo</code>.</p>
365
server to run the script <code>/web/cgi-bin/foo</code>. This configuration
366
is essentially equivalent to:</p>
367
<div class="example"><p><code>
368
Alias /cgi-bin/ /web/cgi-bin/<br />
369
<Location /cgi-bin ><br />
370
<span class="indent">
371
SetHandler cgi-script<br />
372
Options +ExecCGI<br />
377
<div class="warning">It is safer to avoid placing CGI scripts under the
378
<code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> in order to
379
avoid accidentally revealing their source code if the
380
configuration is ever changed. The
381
<code class="directive">ScriptAlias</code> makes this easy by mapping a
382
URL and designating CGI scripts at the same time. If you do
383
choose to place your CGI scripts in a directory already
384
accessible from the web, do not use
385
<code class="directive">ScriptAlias</code>. Instead, use <code class="directive"><a href="../mod/core.html#directory"><Directory></a></code>, <code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code>, and <code class="directive"><a href="../mod/core.html#options">Options</a></code> as in:
386
<div class="example"><p><code>
387
<Directory /usr/local/apache2/htdocs/cgi-bin ><br />
388
<span class="indent">
389
SetHandler cgi-script<br />
390
Options ExecCGI<br />
394
This is necessary since multiple <var>URL-paths</var> can map
395
to the same filesystem location, potentially bypassing the
396
<code class="directive">ScriptAlias</code> and revealing the source code
397
of the CGI scripts if they are not restricted by a
398
<code class="directive"><a href="../mod/core.html#directory">Directory</a></code> section.</div>
403
<li><a href="../howto/cgi.html">CGI Tutorial</a></li>
358
406
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
359
407
<div class="directive-section"><h2><a name="ScriptAliasMatch" id="ScriptAliasMatch">ScriptAliasMatch</a> <a name="scriptaliasmatch" id="scriptaliasmatch">Directive</a></h2>