URI, URL, URN
URI, Uniform Resource Identifier
A URI (Uniform Resource Identifier) is a string that refers to a resource. The most common are URLs, which identify the resource by giving its location on the Web. URNs, by contrast, refer to a resource by a name, in a given namespace, such as the ISBN of a book.
URL, Uniform Resource Locator
URL (Uniform Resource Locator) is a text string that specifies where a resource (such as a web page, image, or video) can be found on the Internet. It is a subset of URI.
In the context of HTTP, URLs are called “Web address” or “link”.
Syntax
- scheme: indicates the protocol that the browser must use to request the resource.
https
/http
: HTTP / HTTPS protocolmailto
: open a email clientftps
/ftp
: FTPS / FTP protocol
- authority: domain + port
- domain: domain name or IP address
- port: TCP/UDP port
80
: http443
: https
- path: the path to the resource on the Web server.
- parameter or query string: extra parameters provided to the Web server, starting with
?
. Those parameters are a list of key/value pairs separated with the&
symbol. - anchor or fragment (frag): an anchor to another part of the resource itself.
Start with
#
.
URN, Uniform Resource Name
URN (Uniform Resource Name) is a URI in a standard format, referring to a resource without specifying its location or whether it exists. This example comes from RFC 3986:
urn:oasis:names:specification:docbook:dtd:xml:4.1.2
Python Examples (Recipes)
References
- URL Living Standard
- RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax
- RFC 6874 - Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers
- RFC 8820 - URI Design and Ownership
- RFC 3305 - Report from the Joint W3C/IETF URI Planning Interest Group: Uniform Resource Identifiers (URIs), URLs, and Uniform Resource Names (URNs): Clarifications and Recommendations
- RFC 8141 - Uniform Resource Names (URNs)
- Wikipedia - URL
- Wikipedia - Uniform Resource Identifier
- Wikipedia - Uniform Resource Name