Directives, Access, and More with the Oracle HTTP Server - Using Aliases
(Page 3 of 5 )
The Alias directive maps URLs to file system locations. The file system location can be a file or a directory, as indicated in the syntax for the Alias directive shown here:
Alias URL-path file-path|directory-path
Using the Alias directive, you can store documents in directories other than the directory specified by the DocumentRoot directive. Here's an example:
Alias /image /ftp/test/image
In the preceding example, a client request for the http://myserver/image/foo.gif file will return the file /ftp/test/image/foo.gif. Here's another example, showing how you can create an entire virtual path structure to hide the underlying file system:
Alias /pub /public
Alias /pub/users /home/users/pub
Alias
/pub/users/john /support/staff/john/public
on the job: If you include a trailing / on the url-path, the server will require a trailing / in order to expand the alias.
You can also specify additional <Directory> sections, which cover the destination of aliases. Because OHS checks aliases before it checks the <Directory> containers, only the destinations of the aliases are affected. Heres an example:
Alias /image /ftp/test/image
<Directory /ftp/test/image>
Order allow,deny
Allow from all
</Directory>
If you've already specified access control for the /ftp/test /image directory, using the Alias directive as shown here will modify the access settings for that directory and its subdirectories.
If you're creating aliases to directories outside the directory specified by DocumentRoot, you must ensure that the server has access to the target directory.
AliasMatch
The AliasMatch directive works similar to the way the Alias directive does, but it uses standard regular expressions instead of simple prefix matching. If the regular expression matches the URL-path, any parenthesized matches are substituted into the given string and used as a filename. Here's an example, which shows how the AliasMatch directive activates the /icons directory:
AliasMatch ^/icons(.*) /usr/local/apache/icons$1
A reference to the icons directory in a URL will be redirected to the real icons directory.
ScriptAlias
The ScriptAlias directive works like the Alias directive, with the difference that it marks the target directory as containing CGI scripts to be executed by the mod_cgi's cgi-script handler. URLs will be mapped to scripts beginning with the second
exam watch: Using ScriptAlias is the
only way to enable the execution of CGI
scripts without specifying the ExecCGI
option, and therefore is useful if you
have a policy of not permitting users to
execute their own CGI scripts.
argument, which refers to a full path name in the local file system. Heres an example:
ScriptAlias /cgi-bin/ /web/cgi-bin/
In the foregoing example, a request for http://myserver/cgi-bin/foo would result in the HTTP server's running the script /web/cgi-bin/foo.
Next: Access Restriction Directives >>
More Oracle Articles
More By McGraw-Hill/Osborne
|
This article is excerpted from chapter five of the book Oracle 10g Application Server Exam Guide, written by Sam Alapati (McGraw-Hill, 2006; ISBN: 0072262710). Check it out today at your favorite bookstore. Buy this book now.
|
|