---
name: "mod_alias"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:25.2.3+dfsg-1+deb12u4"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/mod_alias"
---

# mod\_alias(3erl)

URL aliasing.

## NAME

mod\_alias - URL aliasing.

## DESCRIPTION

Erlang web server internal API for handling of, for example, interaction data exported by module *mod\_alias*.

## EXPORTS

**default\_index(ConfigDB, Path) -\> NewPath**\

Types:

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 Inets User's Guide.

**path(PathData, ConfigDB, RequestURI) -\> Path**\

Types:

PathData = interaction\_data()\
 ConfigDB = config\_db()\
 RequestURI = Path = string()\

*path/3* returns the file *Path* in the *RequestURI* (see RFC 1945). If the interaction data *{real\_name,{Path,AfterPath}}* has been exported by *mod\_alias*, *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 Inets User's Guide.

**real\_name(ConfigDB, RequestURI, Aliases) -\> Ret**\

Types:

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, *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 Inets User's Guide.

**real\_script\_name(ConfigDB, RequestURI, ScriptAliases) -\> Ret**\

Types:

ConfigDB = config\_db()\
 RequestURI = string()\
 ScriptAliases = \[{FakeName,RealName}\]\
 Ret = {ShortPath,AfterPath} \| not\_a\_script\
 ShortPath = AfterPath = string()\

*real\_script\_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, *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 Inets User's Guide.
