- Published on
π URL vs URI vs URN
- Authors
- Name
- Van-Loc Nguyen
- @vanloc1808
Figure: Visual comparison of URI, URL, and URN. Source:
ByteByteGo
π URL vs URI vs URN
In the world of web technologies, these three terms often come up interchangeably - but they have important differences. Letβs clarify:
π URI - Uniform Resource Identifier
A URI is a generic term that identifies a logical or physical resource on the web. Both URL and URN are types of URI.
π‘ URI Syntax:
scheme:[//authority]path[?query][#fragment]
- β A URI may contain both a name and a location.
- β Every URL is a URI, but not every URI is a URL.
π URL - Uniform Resource Locator
A URL is the most common type of URI.
- π It locates a resource on the web.
- π Used heavily with protocols like
http
,https
,ftp
, and evenjdbc
. - π It's the actual address of a resource.
Example:
https://example.com/blog/post?ref=chatgpt
π§Ύ URN - Uniform Resource Name
A URN is another type of URI that names a resource but doesn't tell you where to find it.
- π§± Uses the
urn:
scheme. - β Cannot be used to locate a resource.
- π·οΈ Composed of a namespace and a namespace-specific string.
Example:
urn:isbn:0451450523
π§ Summary
Term | Full Name | Function | Can Locate Resource? |
---|---|---|---|
URI | Uniform Resource Identifier | Generic identifier | β Maybe |
URL | Uniform Resource Locator | Locates the resource | β Yes |
URN | Uniform Resource Name | Names the resource | β No |
π Source
ByteByteGo - URL vs URI vs URN
π Acknowledgments
Special thanks to ChatGPT for enhancing this post with suggestions, formatting, and emojis.