| 1 |
<pre>Network Working Group R. Fielding |
| 2 |
Request for Comments: 1808 UC Irvine |
| 3 |
Category: Standards Track June 1995 |
| 4 |
|
| 5 |
|
| 6 |
<span class="h1">Relative Uniform Resource Locators</span> |
| 7 |
|
| 8 |
Status of this Memo |
| 9 |
|
| 10 |
This document specifies an Internet standards track protocol for the |
| 11 |
Internet community, and requests discussion and suggestions for |
| 12 |
improvements. Please refer to the current edition of the "Internet |
| 13 |
Official Protocol Standards" (STD 1) for the standardization state |
| 14 |
and status of this protocol. Distribution of this memo is unlimited. |
| 15 |
|
| 16 |
Abstract |
| 17 |
|
| 18 |
A Uniform Resource Locator (URL) is a compact representation of the |
| 19 |
location and access method for a resource available via the Internet. |
| 20 |
When embedded within a base document, a URL in its absolute form may |
| 21 |
contain a great deal of information which is already known from the |
| 22 |
context of that base document's retrieval, including the scheme, |
| 23 |
network location, and parts of the url-path. In situations where the |
| 24 |
base URL is well-defined and known to the parser (human or machine), |
| 25 |
it is useful to be able to embed URL references which inherit that |
| 26 |
context rather than re-specifying it in every instance. This |
| 27 |
document defines the syntax and semantics for such Relative Uniform |
| 28 |
Resource Locators. |
| 29 |
|
| 30 |
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span> |
| 31 |
|
| 32 |
This document describes the syntax and semantics for "relative" |
| 33 |
Uniform Resource Locators (relative URLs): a compact representation |
| 34 |
of the location of a resource relative to an absolute base URL. It |
| 35 |
is a companion to <a href="./rfc1738">RFC 1738</a>, "Uniform Resource Locators (URL)" [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>], |
| 36 |
which specifies the syntax and semantics of absolute URLs. |
| 37 |
|
| 38 |
A common use for Uniform Resource Locators is to embed them within a |
| 39 |
document (referred to as the "base" document) for the purpose of |
| 40 |
identifying other Internet-accessible resources. For example, in |
| 41 |
hypertext documents, URLs can be used as the identifiers for |
| 42 |
hypertext link destinations. |
| 43 |
|
| 44 |
Absolute URLs contain a great deal of information which may already |
| 45 |
be known from the context of the base document's retrieval, including |
| 46 |
the scheme, network location, and parts of the URL path. In |
| 47 |
situations where the base URL is well-defined and known, it is useful |
| 48 |
to be able to embed a URL reference which inherits that context |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
<span class="grey">Fielding Standards Track [Page 1]</span></pre> |
| 53 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span> |
| 54 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 55 |
|
| 56 |
|
| 57 |
rather than re-specifying it within each instance. Relative URLs can |
| 58 |
also be used within data-entry dialogs to decrease the number of |
| 59 |
characters necessary to describe a location. |
| 60 |
|
| 61 |
In addition, it is often the case that a group or "tree" of documents |
| 62 |
has been constructed to serve a common purpose; the vast majority of |
| 63 |
URLs in these documents point to locations within the tree rather |
| 64 |
than outside of it. Similarly, documents located at a particular |
| 65 |
Internet site are much more likely to refer to other resources at |
| 66 |
that site than to resources at remote sites. |
| 67 |
|
| 68 |
Relative addressing of URLs allows document trees to be partially |
| 69 |
independent of their location and access scheme. For instance, it is |
| 70 |
possible for a single set of hypertext documents to be simultaneously |
| 71 |
accessible and traversable via each of the "file", "http", and "ftp" |
| 72 |
schemes if the documents refer to each other using relative URLs. |
| 73 |
Furthermore, document trees can be moved, as a whole, without |
| 74 |
changing any of the embedded URLs. Experience within the World-Wide |
| 75 |
Web has demonstrated that the ability to perform relative referencing |
| 76 |
is necessary for the long-term usability of embedded URLs. |
| 77 |
|
| 78 |
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Relative URL Syntax</span> |
| 79 |
|
| 80 |
The syntax for relative URLs is a shortened form of that for absolute |
| 81 |
URLs [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>], where some prefix of the URL is missing and certain path |
| 82 |
components ("." and "..") have a special meaning when interpreting a |
| 83 |
relative path. Because a relative URL may appear in any context that |
| 84 |
could hold an absolute URL, systems that support relative URLs must |
| 85 |
be able to recognize them as part of the URL parsing process. |
| 86 |
|
| 87 |
Although this document does not seek to define the overall URL |
| 88 |
syntax, some discussion of it is necessary in order to describe the |
| 89 |
parsing of relative URLs. In particular, base documents can only |
| 90 |
make use of relative URLs when their base URL fits within the |
| 91 |
generic-RL syntax described below. Although some URL schemes do not |
| 92 |
require this generic-RL syntax, it is assumed that any document which |
| 93 |
contains a relative reference does have a base URL that obeys the |
| 94 |
syntax. In other words, relative URLs cannot be used within |
| 95 |
documents that have unsuitable base URLs. |
| 96 |
|
| 97 |
<span class="h3"><a class="selflink" id="section-2.1" href="#section-2.1">2.1</a>. URL Syntactic Components</span> |
| 98 |
|
| 99 |
The URL syntax is dependent upon the scheme. Some schemes use |
| 100 |
reserved characters like "?" and ";" to indicate special components, |
| 101 |
while others just consider them to be part of the path. However, |
| 102 |
there is enough uniformity in the use of URLs to allow a parser to |
| 103 |
resolve relative URLs based upon a single, generic-RL syntax. This |
| 104 |
generic-RL syntax consists of six components: |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
<span class="grey">Fielding Standards Track [Page 2]</span></pre> |
| 109 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span> |
| 110 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 111 |
|
| 112 |
|
| 113 |
<scheme>://<net_loc>/<path>;<params>?<query>#<fragment> |
| 114 |
|
| 115 |
each of which, except <scheme>, may be absent from a particular URL. |
| 116 |
These components are defined as follows (a complete BNF is provided |
| 117 |
in <a href="#section-2.2">Section 2.2</a>): |
| 118 |
|
| 119 |
scheme ":" ::= scheme name, as per <a href="./rfc1738#section-2.1">Section 2.1 of RFC 1738</a> [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>]. |
| 120 |
|
| 121 |
"//" net_loc ::= network location and login information, as per |
| 122 |
<a href="./rfc1738#section-3.1">Section 3.1 of RFC 1738</a> [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>]. |
| 123 |
|
| 124 |
"/" path ::= URL path, as per <a href="./rfc1738#section-3.1">Section 3.1 of RFC 1738</a> [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>]. |
| 125 |
|
| 126 |
";" params ::= object parameters (e.g., ";type=a" as in |
| 127 |
<a href="./rfc1738#section-3.2.2">Section 3.2.2 of RFC 1738</a> [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>]). |
| 128 |
|
| 129 |
"?" query ::= query information, as per <a href="./rfc1738#section-3.3">Section 3.3 of |
| 130 |
RFC 1738</a> [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>]. |
| 131 |
|
| 132 |
"#" fragment ::= fragment identifier. |
| 133 |
|
| 134 |
Note that the fragment identifier (and the "#" that precedes it) is |
| 135 |
not considered part of the URL. However, since it is commonly used |
| 136 |
within the same string context as a URL, a parser must be able to |
| 137 |
recognize the fragment when it is present and set it aside as part of |
| 138 |
the parsing process. |
| 139 |
|
| 140 |
The order of the components is important. If both <params> and |
| 141 |
<query> are present, the <query> information must occur after the |
| 142 |
<params>. |
| 143 |
|
| 144 |
<span class="h3"><a class="selflink" id="section-2.2" href="#section-2.2">2.2</a>. BNF for Relative URLs</span> |
| 145 |
|
| 146 |
This is a BNF-like description of the Relative Uniform Resource |
| 147 |
Locator syntax, using the conventions of <a href="./rfc822">RFC 822</a> [<a href="#ref-5" title=""Standard for the Format of ARPA Internet Text Messages"">5</a>], except that "|" |
| 148 |
is used to designate alternatives. Briefly, literals are quoted with |
| 149 |
"", parentheses "(" and ")" are used to group elements, optional |
| 150 |
elements are enclosed in [brackets], and elements may be preceded |
| 151 |
with <n>* to designate n or more repetitions of the following |
| 152 |
element; n defaults to 0. |
| 153 |
|
| 154 |
This BNF also describes the generic-RL syntax for valid base URLs. |
| 155 |
Note that this differs from the URL syntax defined in <a href="./rfc1738">RFC 1738</a> [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>] in |
| 156 |
that all schemes are required to use a single set of reserved |
| 157 |
characters and use them consistently within the major URL components. |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
<span class="grey">Fielding Standards Track [Page 3]</span></pre> |
| 165 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span> |
| 166 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 167 |
|
| 168 |
|
| 169 |
URL = ( absoluteURL | relativeURL ) [ "#" fragment ] |
| 170 |
|
| 171 |
absoluteURL = generic-RL | ( scheme ":" *( uchar | reserved ) ) |
| 172 |
|
| 173 |
generic-RL = scheme ":" relativeURL |
| 174 |
|
| 175 |
relativeURL = net_path | abs_path | rel_path |
| 176 |
|
| 177 |
net_path = "//" net_loc [ abs_path ] |
| 178 |
abs_path = "/" rel_path |
| 179 |
rel_path = [ path ] [ ";" params ] [ "?" query ] |
| 180 |
|
| 181 |
path = fsegment *( "/" segment ) |
| 182 |
fsegment = 1*pchar |
| 183 |
segment = *pchar |
| 184 |
|
| 185 |
params = param *( ";" param ) |
| 186 |
param = *( pchar | "/" ) |
| 187 |
|
| 188 |
scheme = 1*( alpha | digit | "+" | "-" | "." ) |
| 189 |
net_loc = *( pchar | ";" | "?" ) |
| 190 |
query = *( uchar | reserved ) |
| 191 |
fragment = *( uchar | reserved ) |
| 192 |
|
| 193 |
pchar = uchar | ":" | "@" | "&" | "=" |
| 194 |
uchar = unreserved | escape |
| 195 |
unreserved = alpha | digit | safe | extra |
| 196 |
|
| 197 |
escape = "%" hex hex |
| 198 |
hex = digit | "A" | "B" | "C" | "D" | "E" | "F" | |
| 199 |
"a" | "b" | "c" | "d" | "e" | "f" |
| 200 |
|
| 201 |
alpha = lowalpha | hialpha |
| 202 |
lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | |
| 203 |
"j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | |
| 204 |
"s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" |
| 205 |
hialpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | |
| 206 |
"J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | |
| 207 |
"S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" |
| 208 |
|
| 209 |
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | |
| 210 |
"8" | "9" |
| 211 |
|
| 212 |
safe = "$" | "-" | "_" | "." | "+" |
| 213 |
extra = "!" | "*" | "'" | "(" | ")" | "," |
| 214 |
national = "{" | "}" | "|" | "\" | "^" | "~" | "[" | "]" | "`" |
| 215 |
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" |
| 216 |
punctuation = "<" | ">" | "#" | "%" | <"> |
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
<span class="grey">Fielding Standards Track [Page 4]</span></pre> |
| 221 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span> |
| 222 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 223 |
|
| 224 |
|
| 225 |
<span class="h3"><a class="selflink" id="section-2.3" href="#section-2.3">2.3</a>. Specific Schemes and their Syntactic Categories</span> |
| 226 |
|
| 227 |
Each URL scheme has its own rules regarding the presence or absence |
| 228 |
of the syntactic components described in Sections <a href="#section-2.1">2.1</a> and <a href="#section-2.2">2.2</a>. In |
| 229 |
addition, some schemes are never appropriate for use with relative |
| 230 |
URLs. However, since relative URLs will only be used within contexts |
| 231 |
in which they are useful, these scheme-specific differences can be |
| 232 |
ignored by the resolution process. |
| 233 |
|
| 234 |
Within this section, we include as examples only those schemes that |
| 235 |
have a defined URL syntax in <a href="./rfc1738">RFC 1738</a> [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>]. The following schemes are |
| 236 |
never used with relative URLs: |
| 237 |
|
| 238 |
mailto Electronic Mail |
| 239 |
news USENET news |
| 240 |
telnet TELNET Protocol for Interactive Sessions |
| 241 |
|
| 242 |
Some URL schemes allow the use of reserved characters for purposes |
| 243 |
outside the generic-RL syntax given above. However, such use is |
| 244 |
rare. Relative URLs can be used with these schemes whenever the |
| 245 |
applicable base URL follows the generic-RL syntax. |
| 246 |
|
| 247 |
gopher Gopher and Gopher+ Protocols |
| 248 |
prospero Prospero Directory Service |
| 249 |
wais Wide Area Information Servers Protocol |
| 250 |
|
| 251 |
Users of gopher URLs should note that gopher-type information is |
| 252 |
almost always included at the beginning of what would be the |
| 253 |
generic-RL path. If present, this type information prevents |
| 254 |
relative-path references to documents with differing gopher-types. |
| 255 |
|
| 256 |
Finally, the following schemes can always be parsed using the |
| 257 |
generic-RL syntax. This does not necessarily imply that relative |
| 258 |
URLs will be useful with these schemes -- that decision is left to |
| 259 |
the system implementation and the author of the base document. |
| 260 |
|
| 261 |
file Host-specific Files |
| 262 |
ftp File Transfer Protocol |
| 263 |
http Hypertext Transfer Protocol |
| 264 |
nntp USENET news using NNTP access |
| 265 |
|
| 266 |
NOTE: <a href="./rfc1738#section-5">Section 5 of RFC 1738</a> specifies that the question-mark |
| 267 |
character ("?") is allowed in an ftp or file path segment. |
| 268 |
However, this is not true in practice and is believed to be an |
| 269 |
error in the RFC. Similarly, <a href="./rfc1738">RFC 1738</a> allows the reserved |
| 270 |
character semicolon (";") within an http path segment, but does |
| 271 |
not define its semantics; the correct semantics are as defined |
| 272 |
by this document for <params>. |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
<span class="grey">Fielding Standards Track [Page 5]</span></pre> |
| 277 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span> |
| 278 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 279 |
|
| 280 |
|
| 281 |
We recommend that new schemes be designed to be parsable via the |
| 282 |
generic-RL syntax if they are intended to be used with relative URLs. |
| 283 |
A description of the allowed relative forms should be included when a |
| 284 |
new scheme is registered, as per <a href="./rfc1738#section-4">Section 4 of RFC 1738</a> [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>]. |
| 285 |
|
| 286 |
<span class="h3"><a class="selflink" id="section-2.4" href="#section-2.4">2.4</a>. Parsing a URL</span> |
| 287 |
|
| 288 |
An accepted method for parsing URLs is useful to clarify the |
| 289 |
generic-RL syntax of <a href="#section-2.2">Section 2.2</a> and to describe the algorithm for |
| 290 |
resolving relative URLs presented in <a href="#section-4">Section 4</a>. This section |
| 291 |
describes the parsing rules for breaking down a URL (relative or |
| 292 |
absolute) into the component parts described in <a href="#section-2.1">Section 2.1</a>. The |
| 293 |
rules assume that the URL has already been separated from any |
| 294 |
surrounding text and copied to a "parse string". The rules are |
| 295 |
listed in the order in which they would be applied by the parser. |
| 296 |
|
| 297 |
<span class="h4"><a class="selflink" id="section-2.4.1" href="#section-2.4.1">2.4.1</a>. Parsing the Fragment Identifier</span> |
| 298 |
|
| 299 |
If the parse string contains a crosshatch "#" character, then the |
| 300 |
substring after the first (left-most) crosshatch "#" and up to the |
| 301 |
end of the parse string is the <fragment> identifier. If the |
| 302 |
crosshatch is the last character, or no crosshatch is present, then |
| 303 |
the fragment identifier is empty. The matched substring, including |
| 304 |
the crosshatch character, is removed from the parse string before |
| 305 |
continuing. |
| 306 |
|
| 307 |
Note that the fragment identifier is not considered part of the URL. |
| 308 |
However, since it is often attached to the URL, parsers must be able |
| 309 |
to recognize and set aside fragment identifiers as part of the |
| 310 |
process. |
| 311 |
|
| 312 |
<span class="h4"><a class="selflink" id="section-2.4.2" href="#section-2.4.2">2.4.2</a>. Parsing the Scheme</span> |
| 313 |
|
| 314 |
If the parse string contains a colon ":" after the first character |
| 315 |
and before any characters not allowed as part of a scheme name (i.e., |
| 316 |
any not an alphanumeric, plus "+", period ".", or hyphen "-"), the |
| 317 |
<scheme> of the URL is the substring of characters up to but not |
| 318 |
including the first colon. These characters and the colon are then |
| 319 |
removed from the parse string before continuing. |
| 320 |
|
| 321 |
<span class="h4"><a class="selflink" id="section-2.4.3" href="#section-2.4.3">2.4.3</a>. Parsing the Network Location/Login</span> |
| 322 |
|
| 323 |
If the parse string begins with a double-slash "//", then the |
| 324 |
substring of characters after the double-slash and up to, but not |
| 325 |
including, the next slash "/" character is the network location/login |
| 326 |
(<net_loc>) of the URL. If no trailing slash "/" is present, the |
| 327 |
entire remaining parse string is assigned to <net_loc>. The double- |
| 328 |
slash and <net_loc> are removed from the parse string before |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
<span class="grey">Fielding Standards Track [Page 6]</span></pre> |
| 333 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span> |
| 334 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 335 |
|
| 336 |
|
| 337 |
continuing. |
| 338 |
|
| 339 |
<span class="h4"><a class="selflink" id="section-2.4.4" href="#section-2.4.4">2.4.4</a>. Parsing the Query Information</span> |
| 340 |
|
| 341 |
If the parse string contains a question mark "?" character, then the |
| 342 |
substring after the first (left-most) question mark "?" and up to the |
| 343 |
end of the parse string is the <query> information. If the question |
| 344 |
mark is the last character, or no question mark is present, then the |
| 345 |
query information is empty. The matched substring, including the |
| 346 |
question mark character, is removed from the parse string before |
| 347 |
continuing. |
| 348 |
|
| 349 |
<span class="h4"><a class="selflink" id="section-2.4.5" href="#section-2.4.5">2.4.5</a>. Parsing the Parameters</span> |
| 350 |
|
| 351 |
If the parse string contains a semicolon ";" character, then the |
| 352 |
substring after the first (left-most) semicolon ";" and up to the end |
| 353 |
of the parse string is the parameters (<params>). If the semicolon |
| 354 |
is the last character, or no semicolon is present, then <params> is |
| 355 |
empty. The matched substring, including the semicolon character, is |
| 356 |
removed from the parse string before continuing. |
| 357 |
|
| 358 |
<span class="h4"><a class="selflink" id="section-2.4.6" href="#section-2.4.6">2.4.6</a>. Parsing the Path</span> |
| 359 |
|
| 360 |
After the above steps, all that is left of the parse string is the |
| 361 |
URL <path> and the slash "/" that may precede it. Even though the |
| 362 |
initial slash is not part of the URL path, the parser must remember |
| 363 |
whether or not it was present so that later processes can |
| 364 |
differentiate between relative and absolute paths. Often this is |
| 365 |
done by simply storing the preceding slash along with the path. |
| 366 |
|
| 367 |
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Establishing a Base URL</span> |
| 368 |
|
| 369 |
The term "relative URL" implies that there exists some absolute "base |
| 370 |
URL" against which the relative reference is applied. Indeed, the |
| 371 |
base URL is necessary to define the semantics of any embedded |
| 372 |
relative URLs; without it, a relative reference is meaningless. In |
| 373 |
order for relative URLs to be usable within a document, the base URL |
| 374 |
of that document must be known to the parser. |
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
<span class="grey">Fielding Standards Track [Page 7]</span></pre> |
| 389 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span> |
| 390 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 391 |
|
| 392 |
|
| 393 |
The base URL of a document can be established in one of four ways, |
| 394 |
listed below in order of precedence. The order of precedence can be |
| 395 |
thought of in terms of layers, where the innermost defined base URL |
| 396 |
has the highest precedence. This can be visualized graphically as: |
| 397 |
|
| 398 |
.----------------------------------------------------------. |
| 399 |
| .----------------------------------------------------. | |
| 400 |
| | .----------------------------------------------. | | |
| 401 |
| | | .----------------------------------------. | | | |
| 402 |
| | | | (3.1) Base URL embedded in the | | | | |
| 403 |
| | | | document's content | | | | |
| 404 |
| | | `----------------------------------------' | | | |
| 405 |
| | | (3.2) Base URL of the encapsulating entity | | | |
| 406 |
| | | (message, document, or none). | | | |
| 407 |
| | `----------------------------------------------' | | |
| 408 |
| | (3.3) URL used to retrieve the entity | | |
| 409 |
| `----------------------------------------------------' | |
| 410 |
| (3.4) Base URL = "" (undefined) | |
| 411 |
`----------------------------------------------------------' |
| 412 |
|
| 413 |
<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Base URL within Document Content</span> |
| 414 |
|
| 415 |
Within certain document media types, the base URL of the document can |
| 416 |
be embedded within the content itself such that it can be readily |
| 417 |
obtained by a parser. This can be useful for descriptive documents, |
| 418 |
such as tables of content, which may be transmitted to others through |
| 419 |
protocols other than their usual retrieval context (e.g., E-Mail or |
| 420 |
USENET news). |
| 421 |
|
| 422 |
It is beyond the scope of this document to specify how, for each |
| 423 |
media type, the base URL can be embedded. It is assumed that user |
| 424 |
agents manipulating such media types will be able to obtain the |
| 425 |
appropriate syntax from that media type's specification. An example |
| 426 |
of how the base URL can be embedded in the Hypertext Markup Language |
| 427 |
(HTML) [<a href="#ref-3" title=""HyperText Markup Language Specification -- 2.0"">3</a>] is provided in an Appendix (<a href="#section-10">Section 10</a>). |
| 428 |
|
| 429 |
Messages are considered to be composite documents. The base URL of a |
| 430 |
message can be specified within the message headers (or equivalent |
| 431 |
tagged metainformation) of the message. For protocols that make use |
| 432 |
of message headers like those described in <a href="./rfc822">RFC 822</a> [<a href="#ref-5" title=""Standard for the Format of ARPA Internet Text Messages"">5</a>], we recommend |
| 433 |
that the format of this header be: |
| 434 |
|
| 435 |
base-header = "Base" ":" "<URL:" absoluteURL ">" |
| 436 |
|
| 437 |
where "Base" is case-insensitive and any whitespace (including that |
| 438 |
used for line folding) inside the angle brackets is ignored. For |
| 439 |
example, the header field |
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
<span class="grey">Fielding Standards Track [Page 8]</span></pre> |
| 445 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span> |
| 446 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 447 |
|
| 448 |
|
| 449 |
Base: <URL:http://www.ics.uci.edu/Test/a/b/c> |
| 450 |
|
| 451 |
would indicate that the base URL for that message is the string |
| 452 |
"<a href="http://www.ics.uci.edu/Test/a/b/c">http://www.ics.uci.edu/Test/a/b/c</a>". The base URL for a message |
| 453 |
serves as both the base for any relative URLs within the message |
| 454 |
headers and the default base URL for documents enclosed within the |
| 455 |
message, as described in the next section. |
| 456 |
|
| 457 |
Protocols which do not use the <a href="./rfc822">RFC 822</a> message header syntax, but |
| 458 |
which do allow some form of tagged metainformation to be included |
| 459 |
within messages, may define their own syntax for defining the base |
| 460 |
URL as part of a message. |
| 461 |
|
| 462 |
<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>. Base URL from the Encapsulating Entity</span> |
| 463 |
|
| 464 |
If no base URL is embedded, the base URL of a document is defined by |
| 465 |
the document's retrieval context. For a document that is enclosed |
| 466 |
within another entity (such as a message or another document), the |
| 467 |
retrieval context is that entity; thus, the default base URL of the |
| 468 |
document is the base URL of the entity in which the document is |
| 469 |
encapsulated. |
| 470 |
|
| 471 |
Composite media types, such as the "multipart/*" and "message/*" |
| 472 |
media types defined by MIME (<a href="./rfc1521">RFC 1521</a>, [<a href="#ref-4" title=""MIME (Multipurpose Internet Mail Extensions): Mechanisms for Specifying and Describing the Format of Internet Message Bodies"">4</a>]), define a hierarchy of |
| 473 |
retrieval context for their enclosed documents. In other words, the |
| 474 |
retrieval context of a component part is the base URL of the |
| 475 |
composite entity of which it is a part. Thus, a composite entity can |
| 476 |
redefine the retrieval context of its component parts via the |
| 477 |
inclusion of a base-header, and this redefinition applies recursively |
| 478 |
for a hierarchy of composite parts. Note that this might not change |
| 479 |
the base URL of the components, since each component may include an |
| 480 |
embedded base URL or base-header that takes precedence over the |
| 481 |
retrieval context. |
| 482 |
|
| 483 |
<span class="h3"><a class="selflink" id="section-3.3" href="#section-3.3">3.3</a>. Base URL from the Retrieval URL</span> |
| 484 |
|
| 485 |
If no base URL is embedded and the document is not encapsulated |
| 486 |
within some other entity (e.g., the top level of a composite entity), |
| 487 |
then, if a URL was used to retrieve the base document, that URL shall |
| 488 |
be considered the base URL. Note that if the retrieval was the |
| 489 |
result of a redirected request, the last URL used (i.e., that which |
| 490 |
resulted in the actual retrieval of the document) is the base URL. |
| 491 |
|
| 492 |
<span class="h3"><a class="selflink" id="section-3.4" href="#section-3.4">3.4</a>. Default Base URL</span> |
| 493 |
|
| 494 |
If none of the conditions described in Sections <a href="#section-3.1">3.1</a> -- 3.3 apply, |
| 495 |
then the base URL is considered to be the empty string and all |
| 496 |
embedded URLs within that document are assumed to be absolute URLs. |
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
<span class="grey">Fielding Standards Track [Page 9]</span></pre> |
| 501 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span> |
| 502 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 503 |
|
| 504 |
|
| 505 |
It is the responsibility of the distributor(s) of a document |
| 506 |
containing relative URLs to ensure that the base URL for that |
| 507 |
document can be established. It must be emphasized that relative |
| 508 |
URLs cannot be used reliably in situations where the document's base |
| 509 |
URL is not well-defined. |
| 510 |
|
| 511 |
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Resolving Relative URLs</span> |
| 512 |
|
| 513 |
This section describes an example algorithm for resolving URLs within |
| 514 |
a context in which the URLs may be relative, such that the result is |
| 515 |
always a URL in absolute form. Although this algorithm cannot |
| 516 |
guarantee that the resulting URL will equal that intended by the |
| 517 |
original author, it does guarantee that any valid URL (relative or |
| 518 |
absolute) can be consistently transformed to an absolute form given a |
| 519 |
valid base URL. |
| 520 |
|
| 521 |
The following steps are performed in order: |
| 522 |
|
| 523 |
Step 1: The base URL is established according to the rules of |
| 524 |
<a href="#section-3">Section 3</a>. If the base URL is the empty string (unknown), |
| 525 |
the embedded URL is interpreted as an absolute URL and |
| 526 |
we are done. |
| 527 |
|
| 528 |
Step 2: Both the base and embedded URLs are parsed into their |
| 529 |
component parts as described in <a href="#section-2.4">Section 2.4</a>. |
| 530 |
|
| 531 |
a) If the embedded URL is entirely empty, it inherits the |
| 532 |
entire base URL (i.e., is set equal to the base URL) |
| 533 |
and we are done. |
| 534 |
|
| 535 |
b) If the embedded URL starts with a scheme name, it is |
| 536 |
interpreted as an absolute URL and we are done. |
| 537 |
|
| 538 |
c) Otherwise, the embedded URL inherits the scheme of |
| 539 |
the base URL. |
| 540 |
|
| 541 |
Step 3: If the embedded URL's <net_loc> is non-empty, we skip to |
| 542 |
Step 7. Otherwise, the embedded URL inherits the <net_loc> |
| 543 |
(if any) of the base URL. |
| 544 |
|
| 545 |
Step 4: If the embedded URL path is preceded by a slash "/", the |
| 546 |
path is not relative and we skip to Step 7. |
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
<span class="grey">Fielding Standards Track [Page 10]</span></pre> |
| 557 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-11" ></span> |
| 558 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 559 |
|
| 560 |
|
| 561 |
Step 5: If the embedded URL path is empty (and not preceded by a |
| 562 |
slash), then the embedded URL inherits the base URL path, |
| 563 |
and |
| 564 |
|
| 565 |
a) if the embedded URL's <params> is non-empty, we skip to |
| 566 |
step 7; otherwise, it inherits the <params> of the base |
| 567 |
URL (if any) and |
| 568 |
|
| 569 |
b) if the embedded URL's <query> is non-empty, we skip to |
| 570 |
step 7; otherwise, it inherits the <query> of the base |
| 571 |
URL (if any) and we skip to step 7. |
| 572 |
|
| 573 |
Step 6: The last segment of the base URL's path (anything |
| 574 |
following the rightmost slash "/", or the entire path if no |
| 575 |
slash is present) is removed and the embedded URL's path is |
| 576 |
appended in its place. The following operations are |
| 577 |
then applied, in order, to the new path: |
| 578 |
|
| 579 |
a) All occurrences of "./", where "." is a complete path |
| 580 |
segment, are removed. |
| 581 |
|
| 582 |
b) If the path ends with "." as a complete path segment, |
| 583 |
that "." is removed. |
| 584 |
|
| 585 |
c) All occurrences of "<segment>/../", where <segment> is a |
| 586 |
complete path segment not equal to "..", are removed. |
| 587 |
Removal of these path segments is performed iteratively, |
| 588 |
removing the leftmost matching pattern on each iteration, |
| 589 |
until no matching pattern remains. |
| 590 |
|
| 591 |
d) If the path ends with "<segment>/..", where <segment> is a |
| 592 |
complete path segment not equal to "..", that |
| 593 |
"<segment>/.." is removed. |
| 594 |
|
| 595 |
Step 7: The resulting URL components, including any inherited from |
| 596 |
the base URL, are recombined to give the absolute form of |
| 597 |
the embedded URL. |
| 598 |
|
| 599 |
Parameters, regardless of their purpose, do not form a part of the |
| 600 |
URL path and thus do not affect the resolving of relative paths. In |
| 601 |
particular, the presence or absence of the ";type=d" parameter on an |
| 602 |
ftp URL does not affect the interpretation of paths relative to that |
| 603 |
URL. Fragment identifiers are only inherited from the base URL when |
| 604 |
the entire embedded URL is empty. |
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
|
| 612 |
<span class="grey">Fielding Standards Track [Page 11]</span></pre> |
| 613 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-12" ></span> |
| 614 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 615 |
|
| 616 |
|
| 617 |
The above algorithm is intended to provide an example by which the |
| 618 |
output of implementations can be tested -- implementation of the |
| 619 |
algorithm itself is not required. For example, some systems may find |
| 620 |
it more efficient to implement Step 6 as a pair of segment stacks |
| 621 |
being merged, rather than as a series of string pattern matches. |
| 622 |
|
| 623 |
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Examples and Recommended Practice</span> |
| 624 |
|
| 625 |
Within an object with a well-defined base URL of |
| 626 |
|
| 627 |
Base: <URL:http://a/b/c/d;p?q#f> |
| 628 |
|
| 629 |
the relative URLs would be resolved as follows: |
| 630 |
|
| 631 |
<span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. Normal Examples</span> |
| 632 |
|
| 633 |
g:h = <URL:g:h> |
| 634 |
g = <URL:http://a/b/c/g> |
| 635 |
./g = <URL:http://a/b/c/g> |
| 636 |
g/ = <URL:http://a/b/c/g/> |
| 637 |
/g = <URL:http://a/g> |
| 638 |
//g = <URL:http://g> |
| 639 |
?y = <URL:http://a/b/c/d;p?y> |
| 640 |
g?y = <URL:http://a/b/c/g?y> |
| 641 |
g?y/./x = <URL:http://a/b/c/g?y/./x> |
| 642 |
#s = <URL:http://a/b/c/d;p?q#s> |
| 643 |
g#s = <URL:http://a/b/c/g#s> |
| 644 |
g#s/./x = <URL:http://a/b/c/g#s/./x> |
| 645 |
g?y#s = <URL:http://a/b/c/g?y#s> |
| 646 |
;x = <URL:http://a/b/c/d;x> |
| 647 |
g;x = <URL:http://a/b/c/g;x> |
| 648 |
g;x?y#s = <URL:http://a/b/c/g;x?y#s> |
| 649 |
. = <URL:http://a/b/c/> |
| 650 |
./ = <URL:http://a/b/c/> |
| 651 |
.. = <URL:http://a/b/> |
| 652 |
../ = <URL:http://a/b/> |
| 653 |
../g = <URL:http://a/b/g> |
| 654 |
../.. = <URL:http://a/> |
| 655 |
../../ = <URL:http://a/> |
| 656 |
../../g = <URL:http://a/g> |
| 657 |
|
| 658 |
<span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. Abnormal Examples</span> |
| 659 |
|
| 660 |
Although the following abnormal examples are unlikely to occur in |
| 661 |
normal practice, all URL parsers should be capable of resolving them |
| 662 |
consistently. Each example uses the same base as above. |
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
<span class="grey">Fielding Standards Track [Page 12]</span></pre> |
| 669 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-13" ></span> |
| 670 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 671 |
|
| 672 |
|
| 673 |
An empty reference resolves to the complete base URL: |
| 674 |
|
| 675 |
<> = <URL:http://a/b/c/d;p?q#f> |
| 676 |
|
| 677 |
Parsers must be careful in handling the case where there are more |
| 678 |
relative path ".." segments than there are hierarchical levels in the |
| 679 |
base URL's path. Note that the ".." syntax cannot be used to change |
| 680 |
the <net_loc> of a URL. |
| 681 |
|
| 682 |
../../../g = <URL:http://a/../g> |
| 683 |
../../../../g = <URL:http://a/../../g> |
| 684 |
|
| 685 |
Similarly, parsers must avoid treating "." and ".." as special when |
| 686 |
they are not complete components of a relative path. |
| 687 |
|
| 688 |
/./g = <URL:http://a/./g> |
| 689 |
/../g = <URL:http://a/../g> |
| 690 |
g. = <URL:http://a/b/c/g.> |
| 691 |
.g = <URL:http://a/b/c/.g> |
| 692 |
g.. = <URL:http://a/b/c/g..> |
| 693 |
..g = <URL:http://a/b/c/..g> |
| 694 |
|
| 695 |
Less likely are cases where the relative URL uses unnecessary or |
| 696 |
nonsensical forms of the "." and ".." complete path segments. |
| 697 |
|
| 698 |
./../g = <URL:http://a/b/g> |
| 699 |
./g/. = <URL:http://a/b/c/g/> |
| 700 |
g/./h = <URL:http://a/b/c/g/h> |
| 701 |
g/../h = <URL:http://a/b/c/h> |
| 702 |
|
| 703 |
Finally, some older parsers allow the scheme name to be present in a |
| 704 |
relative URL if it is the same as the base URL scheme. This is |
| 705 |
considered to be a loophole in prior specifications of partial URLs |
| 706 |
[<a href="#ref-1" title=""Universal Resource Identifiers in WWW: A Unifying Syntax for the Expression of Names and Addresses of Objects on the Network as used in the World-Wide Web"">1</a>] and should be avoided by future parsers. |
| 707 |
|
| 708 |
http:g = <URL:http:g> |
| 709 |
http: = <URL:http:> |
| 710 |
|
| 711 |
<span class="h3"><a class="selflink" id="section-5.3" href="#section-5.3">5.3</a>. Recommended Practice</span> |
| 712 |
|
| 713 |
Authors should be aware that path names which contain a colon ":" |
| 714 |
character cannot be used as the first component of a relative URL |
| 715 |
path (e.g., "this:that") because they will likely be mistaken for a |
| 716 |
scheme name. It is therefore necessary to precede such cases with |
| 717 |
other components (e.g., "./this:that"), or to escape the colon |
| 718 |
character (e.g., "this%3Athat"), in order for them to be correctly |
| 719 |
parsed. The former solution is preferred because it does not affect |
| 720 |
the absolute form of the URL. |
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
<span class="grey">Fielding Standards Track [Page 13]</span></pre> |
| 725 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-14" ></span> |
| 726 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 727 |
|
| 728 |
|
| 729 |
There is an ambiguity in the semantics for the ftp URL scheme |
| 730 |
regarding the use of a trailing slash ("/") character and/or a |
| 731 |
parameter ";type=d" to indicate a resource that is an ftp directory. |
| 732 |
If the result of retrieving that directory includes embedded relative |
| 733 |
URLs, it is necessary that the base URL path for that result include |
| 734 |
a trailing slash. For this reason, we recommend that the ";type=d" |
| 735 |
parameter value not be used within contexts that allow relative URLs. |
| 736 |
|
| 737 |
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Security Considerations</span> |
| 738 |
|
| 739 |
There are no security considerations in the use or parsing of |
| 740 |
relative URLs. However, once a relative URL has been resolved to its |
| 741 |
absolute form, the same security considerations apply as those |
| 742 |
described in <a href="./rfc1738">RFC 1738</a> [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>]. |
| 743 |
|
| 744 |
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Acknowledgements</span> |
| 745 |
|
| 746 |
This work is derived from concepts introduced by Tim Berners-Lee and |
| 747 |
the World-Wide Web global information initiative. Relative URLs are |
| 748 |
described as "Partial URLs" in <a href="./rfc1630">RFC 1630</a> [<a href="#ref-1" title=""Universal Resource Identifiers in WWW: A Unifying Syntax for the Expression of Names and Addresses of Objects on the Network as used in the World-Wide Web"">1</a>]. That description was |
| 749 |
expanded for inclusion as an appendix for an early draft of <a href="./rfc1738">RFC 1738</a>, |
| 750 |
"Uniform Resource Locators (URL)" [<a href="#ref-2" title=""Uniform Resource Locators (URL)"">2</a>]. However, after further |
| 751 |
discussion, the URI-WG decided to specify Relative URLs separately |
| 752 |
from the primary URL draft. |
| 753 |
|
| 754 |
This document is intended to fulfill the recommendations for Internet |
| 755 |
Resource Locators as stated in [<a href="#ref-6" title=""Functional Recommendations for Internet Resource Locators"">6</a>]. It has benefited greatly from |
| 756 |
the comments of all those participating in the URI-WG. Particular |
| 757 |
thanks go to Larry Masinter, Michael A. Dolan, Guido van Rossum, Dave |
| 758 |
Kristol, David Robinson, and Brad Barber for identifying |
| 759 |
problems/deficiencies in earlier drafts. |
| 760 |
|
| 761 |
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. References</span> |
| 762 |
|
| 763 |
[<a id="ref-1">1</a>] Berners-Lee, T., "Universal Resource Identifiers in WWW: A |
| 764 |
Unifying Syntax for the Expression of Names and Addresses of |
| 765 |
Objects on the Network as used in the World-Wide Web", <a href="./rfc1630">RFC 1630</a>, |
| 766 |
CERN, June 1994. |
| 767 |
|
| 768 |
[<a id="ref-2">2</a>] Berners-Lee, T., Masinter, L., and M. McCahill, Editors, "Uniform |
| 769 |
Resource Locators (URL)", <a href="./rfc1738">RFC 1738</a>, CERN, Xerox Corporation, |
| 770 |
University of Minnesota, December 1994. |
| 771 |
|
| 772 |
[<a id="ref-3">3</a>] Berners-Lee T., and D. Connolly, "HyperText Markup Language |
| 773 |
Specification -- 2.0", Work in Progress, MIT, HaL Computer |
| 774 |
Systems, February 1995. |
| 775 |
<URL:http://www.ics.uci.edu/pub/ietf/html/> |
| 776 |
|
| 777 |
|
| 778 |
|
| 779 |
|
| 780 |
<span class="grey">Fielding Standards Track [Page 14]</span></pre> |
| 781 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-15" ></span> |
| 782 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 783 |
|
| 784 |
|
| 785 |
[<a id="ref-4">4</a>] Borenstein, N., and N. Freed, "MIME (Multipurpose Internet Mail |
| 786 |
Extensions): Mechanisms for Specifying and Describing the Format |
| 787 |
of Internet Message Bodies", <a href="./rfc1521">RFC 1521</a>, Bellcore, Innosoft, |
| 788 |
September 1993. |
| 789 |
|
| 790 |
[<a id="ref-5">5</a>] Crocker, D., "Standard for the Format of ARPA Internet Text |
| 791 |
Messages", STD 11, <a href="./rfc822">RFC 822</a>, UDEL, August 1982. |
| 792 |
|
| 793 |
[<a id="ref-6">6</a>] Kunze, J., "Functional Recommendations for Internet Resource |
| 794 |
Locators", <a href="./rfc1736">RFC 1736</a>, IS&T, UC Berkeley, February 1995. |
| 795 |
|
| 796 |
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. Author's Address</span> |
| 797 |
|
| 798 |
Roy T. Fielding |
| 799 |
Department of Information and Computer Science |
| 800 |
University of California |
| 801 |
Irvine, CA 92717-3425 |
| 802 |
U.S.A. |
| 803 |
|
| 804 |
Tel: +1 (714) 824-4049 |
| 805 |
Fax: +1 (714) 824-4056 |
| 806 |
EMail: [email protected] |
| 807 |
|
| 808 |
<span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>. Appendix - Embedding the Base URL in HTML documents</span> |
| 809 |
|
| 810 |
It is useful to consider an example of how the base URL of a document |
| 811 |
can be embedded within the document's content. In this appendix, we |
| 812 |
describe how documents written in the Hypertext Markup Language |
| 813 |
(HTML) [<a href="#ref-3" title=""HyperText Markup Language Specification -- 2.0"">3</a>] can include an embedded base URL. This appendix does not |
| 814 |
form a part of the relative URL specification and should not be |
| 815 |
considered as anything more than a descriptive example. |
| 816 |
|
| 817 |
HTML defines a special element "BASE" which, when present in the |
| 818 |
"HEAD" portion of a document, signals that the parser should use the |
| 819 |
BASE element's "HREF" attribute as the base URL for resolving any |
| 820 |
relative URLs. The "HREF" attribute must be an absolute URL. Note |
| 821 |
that, in HTML, element and attribute names are case-insensitive. For |
| 822 |
example: |
| 823 |
|
| 824 |
<!doctype html public "-//IETF//DTD HTML//EN"> |
| 825 |
<HTML><HEAD> |
| 826 |
<TITLE>An example HTML document</TITLE> |
| 827 |
<BASE href="http://www.ics.uci.edu/Test/a/b/c"> |
| 828 |
</HEAD><BODY> |
| 829 |
... <A href="../x">a hypertext anchor</A> ... |
| 830 |
</BODY></HTML> |
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
<span class="grey">Fielding Standards Track [Page 15]</span></pre> |
| 837 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-16" ></span> |
| 838 |
<span class="grey"><a href="./rfc1808">RFC 1808</a> Relative Uniform Resource Locators June 1995</span> |
| 839 |
|
| 840 |
|
| 841 |
A parser reading the example document should interpret the given |
| 842 |
relative URL "../x" as representing the absolute URL |
| 843 |
|
| 844 |
<URL:http://www.ics.uci.edu/Test/a/x> |
| 845 |
|
| 846 |
regardless of the context in which the example document was obtained. |
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
|
| 852 |
|
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
|
| 890 |
|
| 891 |
|
| 892 |
Fielding Standards Track [Page 16] |
| 893 |
</pre> |