Chapter 3. 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.

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 Host table is shown in Figure 4-2. If no matching host is found, the handler declines to translate the request and standard Apache functionality is resumed.

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:

Example 3-1. A URL request for Midgard


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 enables virtual paths, the remaining tokens are stored as arguments in the C-like $argc $argv[] structure : $argc=2 and $argv=["ffunky","fcool"].

This makes Midgard powered web sites 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.