The process of resolving a relative URL into an absolute URL has many rules, but only a few are often useful:
If the relative URL has a scheme, it’s interpreted as a complete absolute URL by itself. This means you can always put an absolute URL anywhere you put a relative one.
For example, given the base URL http://www.wapforum.org/, the URL http://wap.net/main.wml (which is actually an absolute URL) resolves to http://wap.net/main.wml.
If the relative URL consists of nothing but a fragment, the new URL is simply the entire base URL with the fragment from the relative URL.
For example, given the base URL
file:/homes/martin/foo.wml, the relative URL
#card2 resolves to
If the relative URL has no scheme or network information, the scheme and network information from the base URL are used, together with the parameters, query, and fragment from the relative URL. In addition, the path from the relative URL is interpreted in a special way:
If it starts with a
/ character, it’s used
as it is: the full path from the relative URL is appended to the
scheme and network parts from the base URL.
Otherwise, the paths from the base and relative URLs are each treated
as a list of parts separated by
/ characters. The
last part of the base URL’s path is removed and replaced with
the path from the relative URL.
Any parts consisting entirely of the character
are removed. Parts consisting of the characters
.. are also removed, along with the part before ...