Connected: An Internet Encyclopedia
3. Establishing a Base URL

Up: Connected: An Internet Encyclopedia
Up: Requests For Comments
Up: RFC 1808
Prev: 2.4.6. Parsing the Path
Next: 3.1. Base URL within Document Content

3. Establishing a Base URL

3. Establishing a Base URL

The term "relative URL" implies that there exists some absolute "base URL" against which the relative reference is applied. Indeed, the base URL is necessary to define the semantics of any embedded relative URLs; without it, a relative reference is meaningless. In order for relative URLs to be usable within a document, the base URL of that document must be known to the parser.

The base URL of a document can be established in one of four ways, listed below in order of precedence. The order of precedence can be thought of in terms of layers, where the innermost defined base URL has the highest precedence. This can be visualized graphically as:

      .----------------------------------------------------------.
      |  .----------------------------------------------------.  |
      |  |  .----------------------------------------------.  |  |
      |  |  |  .----------------------------------------.  |  |  |
      |  |  |  |   (3.1) Base URL embedded in the       |  |  |  |
      |  |  |  |         document's content             |  |  |  |
      |  |  |  `----------------------------------------'  |  |  |
      |  |  |   (3.2) Base URL of the encapsulating entity |  |  |
      |  |  |         (message, document, or none).        |  |  |
      |  |  `----------------------------------------------'  |  |
      |  |   (3.3) URL used to retrieve the entity            |  |
      |  `----------------------------------------------------'  |
      |   (3.4) Base URL = "" (undefined)                        |
      `----------------------------------------------------------'


Next: 3.1. Base URL within Document Content

Connected: An Internet Encyclopedia
3. Establishing a Base URL