= Relative URL reference
{c}
A <Relative URL reference> identifies a target using a base <URL> to supply missing context. It can contain a path, a <query string> or a <fragment identifier>, without independently specifying an entire network address. Resolution combines the reference with the base according to a defined algorithm.<Uniform Resource Identifier (URI): Generic Syntax>[Sections4.2 and5.2: relative references and resolution]{ref}
Trailing slashes provide an illuminating comparison. Resolving `c` against `https://example.org/a/b` gives `https://example.org/a/c`; resolving it against `https://example.org/a/b/` gives `https://example.org/a/b/c`. In the first case the last base path segment is replaced, while in the second it names a directory-like prefix.
A parent-directory step is similarly concrete: `../image.png` against `https://example.org/a/b/page.html` gives `https://example.org/a/image.png`. These outcomes follow from URL processing, not from examining an actual filesystem. No network request is needed to calculate them.<URL Standard by WHATWG>[Sections4.4 and6.1: parsing with a base URL]{ref}
The base is therefore part of the input. Copying the same relative spelling into a document with a different base can change its target even when every character of the reference stays unchanged.
Back to article page