Difference between URI and URL
In Web Jan 23, 2022
Updated on Jan 29, 2024
In this post, we'll discuss the difference between a URI and a URL. A Uniform Resource Identifier (URI) is a string that identifies an abstract or physical resource. A Uniform Resource Locator (URL) is a type of URI that, in addition to identifying a resource, provides a mechanism for accessing it.
A URI has a generic syntax, which defines a five-component hierarchical sequence: scheme, authority, path, query, and fragment. Not all URIs have all these five components. Only the scheme and the path components are required.
A URI begins with a scheme name followed by a colon separator. A scheme describes resources identified by a specific criterion.
Examples of such schemes are http
, https
, ftp
, file
,
mailto
, tel
, ssh
. The http
and https
schemes describe
web resources. The ftp
scheme describes resources accessible using the FTP protocol. The
file
scheme designates resources ("files") stored on local or network file systems. The
mailto
scheme is used to identify resources that can be reached using Internet mail. The tel
scheme describes resources identified by the telephone numbers. The ssh
scheme is used for ssh
connections.
The authority component refers to an authority using a domain name or web address. It also can include a username and a port. The authority component is preceded by a double slash.
The path, query, and fragment are used to identify a resource. If an authority component is present, the path must be empty or start with a slash.
The purpose of a URI is to describe a resource. The presence of a URI doesn't imply an accessible resource. But many URIs identify resources and, in addition, a way to access them by describing their primary access mechanism. These URIs are called URLs.
The purpose of a URL is to identify a resource by its network address using schemes like http
,
https
, or ftp
.
Conclusion
URIs describe all kinds of resources and not necessary web resources. URLs are URIs that identify web resources by specifying their location.
Bibliography
- Berners-Lee, T., Fielding, R., and L. Masinter, “Uniform Resource Identifier (URI): Generic Syntax”, STD 66, RFC 3986, January 2005.
- “Uniform Resource Identifier (URI) Schemes”, IANA, https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
- “URIs, URLs, and URNs: Clarifications and Recommendations 1.0”, W3C, https://www.w3.org/TR/uri-clarification/