urlnomenclature

What is the definition of an absolute URL (fully qualified?)


There are (at least) three ways to link to a resource:

  1. href="foo/bar.html"
  2. href="/foo/bar.html"
  3. href="http://example.com/foo/bar.html"

The first is a "relative url", no problem. But I've seen (2) and (3) both referred to as an "absolute url". Which is correctly termed an "absolute url", and what is the proper name of the other?

(Bonus points for references to relevant standards or other official documentation.)


Solution

  • RFC 3986 defines Uniform Resource Identifiers.

    A relative reference that begins with a single slash character is
    termed an absolute-path reference. A relative reference that does
    not begin with a slash character is termed a relative-path reference.

    1. href="foo/bar.html" is a relative reference, specifically a relative-path reference.
    2. href="/foo/bar.html" is a relative reference with an absolute path
    3. href="http://example.com/foo/bar.html" is an absolute URI
    4. href="//example.com/foo/bar.html" is a network-path reference

    A relative reference that begins with two slash characters is termed a network-path reference; such references are rarely used.