Have you encountered yourselves hesitating when trying to use the terms URI or URL?
I have; and apparently the difference between a URI and a URL is a very debated topic on the web. In addition, it’s also a source of confusion for many people, including myself.
Almost every comparison that I find seems to be a tongue-twister, which vaguely describes that they are related but they’re not the same (aha! you see? I did it too, I said something but actually said nothing). The truth is that there’s a different RFC describing the scheme of each, URI’s and URL’s. If you go through the W3C documentation you’ll find that they have a documentation page trying to clarify the confusion around URI’s.
In the end? What’s are URI’s and what are URL’s?
The RFC2396 describes a Uniform Resource Identifier (URI) as a set of characters used to identify a resource name, location or both on the internet. This means that an URI can be classified as a locator (URL), a name (URN), or both.The RFC2717describes a “Uniform Resource Locator” (URL)as a compact string representation of the location for a resource that is available via the Internet.Parting from these definitions we can conclude that every time we refer to a URL we are talking about an URI, but not the other way.
So? Can we use them interchangeably?
The short answer is, NO. Even though its a tendency among experts, this World Wide Web Consortium memo states that there shouldn’t be any confusion, since they all have different schemes (URI’s, URL’s and URN’s) describing the differences among them. BUT!!! If we are talking about “how to identify the resource and provide the means of locating it by describing it’s primary access mechanism” then we are talking about an URL, which is also an URI; therefore we can use them interchangeably in that specific case.
When talking about Internet resources we tend to use these terms to refer to them, specially when talking about HTTP verbs in order to manipulate a document. So, there’s always the safe way of doing things: if you don’t know if you are talking an URL or an URI, just refer to it as an URI and you wont be wrong.