About the difference between URLs and URIs
In this article, we learned about the difference between a Uniform Resource Locator (URL) and a Uniform Resource Identifier (URI).
This time I spent some time refactoring some code that consisted of a webview, and I came across a URI. At first I thought it was a typo, but then I realized that it’s an acronym with a different meaning, which I’d like to share.
Let’s start with the misunderstood URL.
What is a URL (Uniform Resource Locator)?
It’s a subset of a URI that specifies a specific location for a resource. In other words, a URL is an address that tells you the “location” of a specific file, page, etc. on the web.
Example URL
The address ‘https://www.example.com/pages’ is a URL - it points to the exact location of a specific page on the web. At the same time, this address is also a URI, because it uniquely identifies a specific resource.
What is a Uniform Resource Identifier (URI)? It is the only string of characters that identifies a specific resource on the Internet. A URI might not specify the location of a resource. Instead, a URI provides a way to provide the only name for a resource in a particular namespace.
Example URI
An address like ‘example@example.com’ is a URI. This address is used to identify an email address, but it does not specify the actual “location” of the email address. Therefore, it is a URI, but not a URL.
Conclusion
Every URL is a URI, but not every URI is a URL. A URL is a special case of a URI that specifies the physical location of a resource.