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
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 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
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.
blog comments powered by Disqus |
|
|
|
|
|
|
|