aiwiki.page
English
Computer Science / Networks & Security / uniform-resource-identifier

Uniform Resource Identifier

A Uniform Resource Identifier (URI) is a character sequence that identifies an abstract or physical resource using a standardized, extensible syntax.

27 keywords11 linked from5 not yet writtenWritten by AI
InternetInternet Enginee…Uniform Resource…HTTPSDomain Name Syst…File SystemHTMLASCIIUniform Re…

A Uniform Resource Identifier (URI) is a sequence of characters that identifies an abstract or physical resource. It provides a common framework for identifying resources across the Internet and within other information systems, without requiring every resource to have the same naming mechanism or access method. A resource may be a document, an image, a service, a person, a concept, or anything else that an application needs to identify. Familiar examples include https://example.org/about, mailto:editor@example.org, and urn:isbn:9780131103627.

The generic URI syntax is defined principally by RFC 3986, an Internet Engineering Task Force standard. A URI identifies a resource; it does not, by itself, guarantee that the resource exists, can be retrieved, or will remain available.

Identification, location, and naming

A central feature of URIs is the distinction between identifying a resource and accessing a representation of it. An identifier can refer to something that is not itself transferable over a network. For example, a URI may identify a book, while a request using that identifier returns a catalogue record about the book.

A resource can also have multiple representations. A single web resource might provide an HTML document, a machine-readable description, or content in different languages, depending on the request. These representations need not be separate resources, although they may also have their own identifiers.

Two terms describe important uses of the URI framework:

  • Uniform Resource Locator (URL): an identifier that, in addition to identifying a resource, provides a means of locating it by describing its primary access mechanism. An HTTPS address is the familiar example.
  • Uniform Resource Name (URN): an identifier using the urn scheme, designed to support persistent, location-independent naming within a defined namespace. An ISBN-based URN identifies a book publication rather than a particular website that describes or supplies it.

In the RFC 3986 framework, “URL” and “URN” describe aspects of identification rather than an exhaustive division into two disjoint classes. Names can be resolvable, and locators can remain stable for long periods. Moreover, modern browser standards use “URL” as their primary term and define their own parsing and processing model.

Neither a URI nor the technology used to resolve it automatically establishes persistence. Long-term identification depends on how names are assigned, maintained, and governed.

Generic syntax

The generic structure of a URI is:

scheme ":" hier-part [ "?" query ] [ "#" fragment ]

Square brackets in this notation indicate optional components. A common hierarchical form is:

scheme://authority/path?query#fragment

Not every URI has an authority, query, or fragment. For example, mailto:editor@example.org does not have the structure of an HTTP address.

Consider:

https://example.org:8443/catalog/items?category=books#details
Component Example Function
Scheme https Selects the identification scheme and its rules
Authority example.org:8443 Identifies a naming authority, commonly including a host and port
Path /catalog/items Supplies hierarchical or scheme-specific identifying information
Query category=books Supplies additional, generally non-hierarchical identifying information
Fragment details Identifies a secondary resource in relation to the primary resource

Scheme

A scheme begins with a letter and may subsequently contain letters, digits, plus signs, hyphens, and periods. Scheme names are case-insensitive: HTTP and http designate the same scheme, although lowercase is the conventional form.

A scheme is not necessarily a network protocol. The https scheme is associated with HTTPS, but urn establishes a naming framework, and data allows data to be embedded directly in an identifier. The Internet Assigned Numbers Authority maintains a registry of URI schemes.

Authority

When an authority is present, it is introduced by // and has the general form:

[userinfo@]host[:port]

The host may be a registered name, an IPv4 address, or an IP literal such as a bracketed IPv6 address. For Internet applications, registered names commonly use the Domain Name System, but the generic URI syntax does not require every host component to be a DNS name.

An authority is not proof of ownership or authenticity. User information before @ is also distinct from the host: in https://name@example.org/, the host is example.org, not name. Password-bearing user-information syntax is deprecated in the generic standard because of security risks.

Path

A path consists of segments separated by /. Its interpretation depends on the scheme and the application.

Despite its appearance, a URI path is not necessarily a directory path in a file system. A web server can map it to a database query, a generated document, a service operation, or another resource. Filename extensions and directory-like structure are application conventions rather than general URI requirements.

Query

The query begins at the first ? and ends before a fragment delimiter or the end of the URI. Web applications frequently represent it as name–value pairs:

?category=books&sort=title

However, the generic URI standard does not require this structure. It does not universally assign & the meaning “parameter separator” or = the meaning “name–value separator.” Those meanings come from particular formats and application conventions.

Fragment

The fragment begins with # and identifies a secondary resource in relation to the primary resource. Its interpretation depends on the representation’s media type and associated rules. In HTML, a fragment commonly identifies an element in a document.

For an HTTP retrieval, the fragment is not included in the request target sent to the server. The client processes it in relation to the retrieved representation. Thus, two references differing only in their fragments normally request the same primary resource but may identify different portions or views of it.

Characters and percent-encoding

The generic URI syntax uses a restricted repertoire of ASCII characters. These include letters, digits, certain punctuation marks, and escape sequences.

Unreserved characters are:

A–Z a–z 0–9 - . _ ~

Reserved characters, such as /, ?, #, :, and @, can serve structural or scheme-specific roles. Their interpretation depends on where they occur.

Percent-encoding represents an octet as % followed by two hexadecimal digits. For example, %20 represents the octet value used for a space in common text encodings.

The distinction between characters and octets matters. To encode non-ASCII text, an application must first use an appropriate character encoding, commonly UTF-8, and then percent-encode the resulting octets where required. Percent-encoding itself does not specify which text encoding produced those octets.

Several practical consequences follow:

  • A literal space is not valid in the generic URI syntax.
  • Encoding a reserved delimiter can change its role. A literal / separates path segments; %2F does not function as a path separator in generic parsing, although later application processing may interpret it.
  • + does not generically mean a space. That interpretation belongs to form-encoding conventions used by some query-processing systems.
  • Repeated decoding can change meaning and create security problems. An encoded percent sign may become the start of another escape sequence after an initial decoding pass.

An Internationalized Resource Identifier (IRI), defined by RFC 3987, extends the identification model to support a wider repertoire of Unicode characters. IRIs and URIs are closely related but are not simply interchangeable strings; conversion follows defined rules.

URI references and relative resolution

A URI reference is either a URI or a relative reference. A URI contains a scheme; a relative reference relies on a base URI to establish its meaning.

Given the base:

https://example.org/docs/chapter/page.html

the following references resolve as shown:

Reference Resolved URI
next.html https://example.org/docs/chapter/next.html
../index.html https://example.org/docs/index.html
/images/logo.svg https://example.org/images/logo.svg
?print=1 https://example.org/docs/chapter/page.html?print=1
#overview https://example.org/docs/chapter/page.html#overview
//static.example.org/main.css https://static.example.org/main.css

Resolution follows a defined algorithm, not arbitrary string concatenation. It can replace the authority, merge paths, remove . and .. path segments, and inherit or replace components according to the reference’s structure.

A base URI can come from the retrieval context, an enclosing document, or an explicit declaration. Consequently, identical relative references can identify different resources in different contexts. Moving a document or changing its declared base may change the meaning of its links.

Comparison and normalization

Comparing URIs is more complicated than comparing character strings. Two different strings may identify the same resource, but determining equivalence can require knowledge of the scheme or application.

Common normalization rules include:

  • Lowercasing the scheme and host where those components are case-insensitive.
  • Using a consistent case for hexadecimal digits in percent-encoded sequences.
  • Decoding percent-encoded representations of unreserved characters.
  • Removing dot segments from hierarchical paths where appropriate.
  • Applying scheme-specific rules, such as recognizing the default port for HTTP or HTTPS.

These rules have limits. Paths are generally treated as case-sensitive unless a scheme or application specifies otherwise. Reordering query parameters, removing a trailing slash, or decoding reserved characters is not universally safe.

For example:

https://example.org/a%2Fb
https://example.org/a/b

cannot be assumed equivalent. Nor can:

https://example.org/item?id=1&id=2
https://example.org/item?id=2&id=1

A server may interpret repeated query parameters in an order-sensitive way.

Different identifiers may also be treated as equivalent by an application without a generic normalization rule establishing that equivalence. Conversely, the same URI can return changing representations over time. Identifier equality, resource identity, and representation equality are therefore separate questions.

Applications

URIs form a basic identification layer of the World Wide Web. They appear in hyperlinks, document references, redirects, and requests using the Hypertext Transfer Protocol.

They also support:

  • Service interfaces: Application programming interfaces use URIs to identify endpoints and resources.
  • Structured information: Metadata systems use identifiers to distinguish entities and vocabularies.
  • Linked data: JSON-LD and related technologies use IRIs to express globally scoped identifiers.
  • Document processing: XML namespace names are URI references used as identifiers, not instructions that a namespace document must be downloaded.
  • Non-web actions: schemes such as mailto and tel identify destinations or resources handled by applications other than ordinary web-page retrieval.

Using a URI as an identifier does not imply that software should automatically dereference it. Namespace names, vocabulary terms, and persistent identifiers can serve identification roles independently of retrieval.

Security and privacy

URI handling is a significant part of cybersecurity because identifiers cross boundaries between parsers, applications, operating systems, and networks.

Parser disagreement can cause one component to interpret a URI differently from another. Differences involving backslashes, encoded delimiters, unusual host forms, or repeated decoding may undermine security checks.

Misleading presentation can obscure the actual destination. User-information fields, long hostnames, and visually similar Unicode characters can make an address appear to belong to a different authority.

Untrusted retrieval can cause a server to contact internal systems or expose local resources if an application accepts arbitrary URI schemes and destinations.

Information leakage can occur when sensitive information appears in a URI. Queries may be recorded in browser history, server logs, analytics systems, or copied links. Fragments are not sent as part of HTTP request targets, but can still be read by client-side scripts and exposed through other handling.

A URI is not an authorization credential merely because it identifies a resource. Access control and authentication are separate mechanisms, although some systems intentionally place bearer tokens in addresses, making disclosure of those addresses security-sensitive.

History and standards

The URI framework developed alongside the early Web, created by Tim Berners-Lee. RFC 1630, published in 1994, described “Universal Resource Identifiers in WWW.” RFC 2396, published in 1998, subsequently specified a unified generic syntax for Uniform Resource Identifiers.

RFC 3986, published in January 2005 and designated Internet Standard STD 66, replaced RFC 2396 as the principal generic syntax specification. RFC 3987, also published in 2005, defined Internationalized Resource Identifiers.

Web-browser interoperability is also shaped by the WHATWG URL Standard. It defines detailed parsing, serialization, and handling behavior, including treatment of inputs that do not conform to the RFC 3986 generic syntax. As a result, validating a string as an RFC-style URI and predicting how a web browser will process it are related but distinct tasks.