Host, URL and Dynamic Page Parameters
A URL request sent by the browser contains three distinct pieces of information: host name, page name and its path, and possible arguments for the target page.
Mapping URLs to Hosts
Midgard hooks a filter into Apache that checks every request to determine if it's targeted at a Midgard enabled site. Its translation handler searches for a Midgard Host record that matches the following criteria:
the longest match for the host name or host name and prefix
the host record port is either
0(any), matches the requested number, or is the default (80).the host online field is set to online.
If no matching host is found, the handler declines to translate the request and standard Apache functionality is resumed.
Mapping URLs to Pages
The path to a page is the location within a Page tree hierarchy, rather than a directory location under Apache's server root. The arguments can be passed in a Midgard specific syntax that mimics traditional file directory syntax. Here is an example:
http://foo.org:80/foo/Geeks/Functions/ffunky/fcool.html?arg1=kiki&arg2=koko
|____________| |_____________| |_______________||__________________|
host + prefix path to page arguments more arguments
(Midgard syntax) (usual syntax)
Functions is the leaf page here, i.e. there is no ffunky page in the page hierarchy. If this targeted Page is marked Active enabling virtual paths, the remaining tokens are stored as arguments in the C-like $argc $argv[] structure: $_MIDGARD['argc'] = 2 and $_MIDGARD['argv'] = Array("ffunky", "fcool").
This makes Midgard powered web sites provide filesystem-like URLs, and be more easily crawlable by search engine spiders. The .html extension is here for compatibility and is stripped during URL translation. Any other extension remains unchanged. You may use the usual syntax for arguments as well.
