What is URI?
URI is a string of characters that identifies a resource on the internet or within a system, providing a standardized way to locate or name resources using a specific syntax.
Quick Facts
| Full Name | Uniform Resource Identifier |
|---|---|
| Created | 1994 (RFC 1630), standardized 1998 (RFC 2396) |
| Specification | Official Specification |
How It Works
URI serves as a universal naming and addressing system for resources in computing. It encompasses both URLs (Uniform Resource Locators) that specify how to access a resource, and URNs (Uniform Resource Names) that provide persistent identifiers. URIs follow a structured syntax defined by RFC 3986, consisting of a scheme, authority, path, query, and fragment components. This standardized format enables consistent resource identification across different protocols and systems, forming the foundation of web architecture and distributed computing.
Key Characteristics
- Follows RFC 3986 standard syntax structure
- Consists of scheme, authority, path, query, and fragment components
- Supports hierarchical and opaque naming schemes
- Case-sensitive in path and query components
- Uses percent-encoding for special characters
- Enables both location (URL) and name (URN) based identification
Common Use Cases
- Identifying web resources and API endpoints
- Referencing files and documents in applications
- Linking resources in hypertext documents
- Configuring service connections and database URLs
- Implementing RESTful web services
Example
Loading code...Frequently Asked Questions
What is the difference between URI and URL?
A URI (Uniform Resource Identifier) is a superset that includes both URLs and URNs. A URL (Uniform Resource Locator) specifies how to access a resource with a protocol, while a URN (Uniform Resource Name) provides a persistent name without access information.
What are the components of a URI?
A URI consists of five components: scheme (protocol), authority (host and optional port), path (resource location), query (parameters after ?), and fragment (section identifier after #). Not all components are required in every URI.
Why do special characters need encoding in URIs?
Special characters like spaces, ampersands, and non-ASCII characters must be percent-encoded because URIs can only contain a limited set of ASCII characters. Encoding ensures reliable transmission across different systems and protocols.
Are URIs case-sensitive?
It depends on the component. The scheme and host are case-insensitive, but the path, query, and fragment are typically case-sensitive. This means 'example.com' equals 'EXAMPLE.COM', but '/Page' differs from '/page'.
What is a relative URI versus an absolute URI?
An absolute URI includes the complete path starting with the scheme (like https://example.com/path), while a relative URI omits some components and is resolved against a base URI (like ../images/logo.png).