Network Working Group R. Fielding
Request for Comments: 1808 UC Irvine
Category: Standards Track June 1995
Relative Uniform Resource Locators
Status of this Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Abstract
A Uniform Resource Locator (URL) is a compact representation of the
location and access method for a resource available via the Internet.
When embedded within a base document, a URL in its absolute form may
contain a great deal of information which is already known from the
context of that base document's retrieval, including the scheme,
network location, and parts of the url-path. In situations where the
base URL is well-defined and known to the parser (human or machine),
it is useful to be able to embed URL references which inherit that
context rather than re-specifying it in every instance. This
document defines the syntax and semantics for such Relative Uniform
Resource Locators.
1. Introduction
This document describes the syntax and semantics for "relative"
Uniform Resource Locators (relative URLs): a compact representation
of the location of a resource relative to an absolute base URL. It
is a companion to RFC 1738, "Uniform Resource Locators (URL)" [2],
which specifies the syntax and semantics of absolute URLs.
A common use for Uniform Resource Locators is to embed them within a
document (referred to as the "base" document) for the purpose of
identifying other Internet-accessible resources. For example, in
hypertext documents, URLs can be used as the identifiers for
hypertext link destinations.
Absolute URLs contain a great deal of information which may already
be known from the context of the base document's retrieval, including
the scheme, network location, and parts of the URL path. In
situations where the base URL is well-defined and known, it is useful
to be able to embed a URL reference which inherits that context
RFC 1808 Relative Uniform Resource Locators June 1995
rather than re-specifying it within each instance. Relative URLs can
also be used within data-entry dialogs to decrease the number of
characters necessary to describe a location.
In addition, it is often the case that a group or "tree" of documents
has been constructed to serve a common purpose; the vast majority of
URLs in these documents point to locations within the tree rather
than outside of it. Similarly, documents located at a particular
Internet site are much more likely to refer to other resources at
that site than to resources at remote sites.
Relative addressing of URLs allows document trees to be partially
independent of their location and access scheme. For instance, it is
possible for a single set of hypertext documents to be simultaneously
accessible and traversable via each of the "file", "http", and "ftp"
schemes if the documents refer to each other using relative URLs.
Furthermore, document trees can be moved, as a whole, without
changing any of the embedded URLs. Experience within the World-Wide
Web has demonstrated that the ability to perform relative referencing
is necessary for the long-term usability of embedded URLs.
2. Relative URL Syntax
The syntax for relative URLs is a shortened form of that for absolute
URLs [2], where some prefix of the URL is missing and certain path
components ("." and "..") have a special meaning when interpreting a
relative path. Because a relative URL may appear in any context that
could hold an absolute URL, systems that support relative URLs must
be able to recognize them as part of the URL parsing process.
Although this document does not seek to define the overall URL
syntax, some discussion of it is necessary in order to describe the
parsing of relative URLs. In particular, base documents can only
make use of relative URLs when their base URL fits within the
generic-RL syntax described below. Although some URL schemes do not
require this generic-RL syntax, it is assumed that any document which
contains a relative reference does have a base URL that obeys the
syntax. In other words, relative URLs cannot be used within
=1= |