mod_alias(3erl)
π¦ mod_alias π¦
okay bestie, welcome to mod_alias β it's an Erlang module definition from the inets fam, and it's literally all about URL aliasing. iykyk π
β¨ NAME β¨
mod_alias β URL aliasing, periodt. π
πΈ DESCRIPTION πΈ
so this is the Erlang web server internal API for handling stuff like interaction data exported by module mod_alias. that's the whole vibe β it's the behind-the-scenes machinery that keeps your URL aliasing looking cute. π«Ά
π EXPORTS π
π default_index(ConfigDB, Path) -> NewPath
Types:
ConfigDB = config_db()
Path = NewPath = string()
okay so here's the tea β β if Path is a directory, default_index/2 starts searching for resources or files that are specified in the config directive DirectoryIndex. and if it finds an appropriate resource or file, it gets appended to the end of Path and then returned to you. slay. β¨
but if no appropriate file is found β or if Path isn't even a directory β then Path comes back unaltered. no changes, no notes, we move on. π
oh and config_db() is the server config file in ETS table format, as described in the Inets User's Guide. iconic behavior fr fr.
π¦ 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). π
so like, if the interaction data {real_name,{Path,AfterPath}} has been exported by mod_alias, then boom β Path is returned. easy.
but if no interaction data has been exported? then ServerRoot is used to generate a file Path. that's the fallback, bestie. π§
config_db() and interaction_data() are as defined in the 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. π₯
then the resulting path gets split into two parts, ShortPath and AfterPath, as defined in httpd_util:split_path/1. and Path is generated from ShortPath β that is, the result from default_index/2 with ShortPath as an argument. it's giving very much full-circle moment. πΈ
config_db() is the server config file in ETS table format as described in the 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, same energy as before β and matches each FakeName with RequestURI. match found? then FakeName gets replaced with RealName in the match. π«
now here's the plot twist π β if the resulting match is not an executable script, you get not_a_script back. that's it, that's the answer.
but if it is a script? then the resulting script path comes 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 the Inets User's Guide. no cap.
ngl bestie, every one of these functions is living that config_db() life β the server config file in ETS table format, as described in the Inets User's Guide. if you remember one thing from this page, make it that. π
made with love by Ericsson AB π β this is inets version 8.3.1.2, and the page itself is mod_alias(3erl). mwah, go forth and alias those URLs, icon. πβ¨
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms