This module makes it possible to map different parts of the host file system into the document tree. The following config directives are described:
Syntax: Alias
url-path directory-filename
Default: - None -
Module: mod_alias(3)
The Alias directive allows documents to be stored in the local
file system instead of the
DocumentRoot
location. URLs with a path that begins with url-path
is
mapped to local files that begins with directory-filename
,
for example:
Alias /image /ftp/pub/image
and an access to http://your.server.org/image/foo.gif
would
refer to the file /ftp/pub/image/foo.gif
.
Syntax: DirectoryIndex
file file ...
Default: - None -
Module: mod_alias(3)
DirectoryIndex
specifies a list of resources to look
for if a client requests a directory using a /
at the
end of the directory name. file
depicts the name of a
file in the directory. Several files may be given, in which case
the server will return the first it finds, for example:
DirectoryIndex index.html
and access to http://your.server.org/docs/
would
return http://your.server.org/docs/index.html
if it
existed.
Syntax: ScriptAlias
url-path directory-filename
Default: - None -
Module: mod_alias(3)
The ScriptAlias directive has the same behavior as the
Alias directive, except that it also
marks the target directory as containing CGI scripts. URLs with
a path beginning with url-path
are mapped to scripts
beginning with directory-filename
, for example:
ScriptAlias /cgi-bin/ /web/cgi-bin/
and an access to http://your.server.org/cgi-bin/foo
would
cause the server to run the script /web/cgi-bin/foo
.
Exports the following EWSAPI interaction data, if possible:
{real_name,{Path,AfterPath}}
Path
and AfterPath
is as defined in
httpd_util:split_path/1
with one exception - Path
has been run through
default_index/2.
Uses the following exported EWSAPI functions:
This module furthermore exports a batch of functions to be used by other EWSAPI modules:
default_index(ConfigDB,Path) -> NewPath
ConfigDB = config_db()
Path = NewPath = string()
If Path
is a directory, default_index/2
, it starts
searching for resources or files that are specified in the config
directive DirectoryIndex.
If an appropriate resource or file is found, it is appended to
the end of Path
and then returned. Path
is
returned unaltered, if no appropriate
file is found, or if Path
is not a directory.
config_db()
is the server config file in ETS table format
as described in
httpd(3).
path(Data,ConfigDB,RequestURI) -> Path
Data = interaction_data()
ConfigDB = config_db()
RequestURI = Path = string()
path/3
returns the actual file Path
in
the RequestURI
(See RFC 1945). If the interaction
data {real_name,{Path,AfterPath}}
has been exported
by mod_alias(3);
Path
is returned. If no interaction data has been
exported, ServerRoot is used to
generate a file Path
. config_db()
and
interaction_data()
are as defined in
httpd(3).
real_name(ConfigDB,RequestURI,Aliases) -> Ret
ConfigDB = config_db()
RequestURI = string()
Aliases = [{FakeName,RealName}]
Ret = {ShortPath,Path,AfterPath}
ShortPath = Path = AfterPath = string()
real_name/3
traverses Aliases
, typically
extracted from ConfigDB
, and matches each
FakeName
with RequestURI
. If a match is found
FakeName
is replaced with RealName
in the
match. The resulting path is split into two parts, that
is ShortPath
and AfterPath
as defined in httpd_util:split_path/1.
Path
is generated from ShortPath
, that is
the result from default_index/2 with
ShortPath
as an argument.
config_db()
is the server config file in ETS table
format as described in httpd(3).
real_script_name(ConfigDB,RequestURI,ScriptAliases) -> Ret
ConfigDB = config_db()
RequestURI = string()
ScriptAliases = [{FakeName,RealName}]
Ret = {ShortPath,AfterPath} | not_a_script
ShortPath = AfterPath = string()
real_name/3
traverses ScriptAliases
,
typically extracted from ConfigDB
, and matches each
FakeName
with RequestURI
. If a match is found
FakeName
is replaced with RealName
in the
match. If the resulting match is not an executable script
not_a_script
is returned. If it is a script the
resulting script path is in two parts, that is
ShortPath
and AfterPath
as defined in
httpd_util:split_script_path/1.
config_db()
is the server config file in ETS table
format as described in httpd(3).