Working as a web developer means it's good to know as much about how the internet works as possible. It also means you'll hear a lot of acronyms that aren't always used correctly.
An example of some of the acronyms you'll hear are URIs and URLs. While they are used interchangeably, there are some subtle differences. For starters, URI stands for uniform resource identifier and URL stands for uniform resource locator.
Most of the confusion with these two is because they are related. You see, a URI can be a name, locator, or both for an online resource where a URL is just the locator. URLs are a subset of URIs. That means all URLs are URIs. It doesn't work the opposite way though.
Not all URIs are URLs because a URI could be a name instead of a locator. Here's an illustration of the difference between the two:
Your name could be a URI because it identifies you, but it couldn't be a URL because it doesn't help anyone find your location. On the other hand, your address is both a URI and a URL because it both identifies you and it provides a location for you.
In the web dev world, you might be trying to get different resources by name so you'll have different URIs that have distinct URLs. And that's how the confusion started. Now that you know the difference, hopefully it won't be as hard for you to figure out what you need and where to find it when people start talking about resources.
Remember, a URL is the locator of a resource. The URI is the identifier of the resource and it can just happen to be a locator. I hope this helped clear up some of the jargon we use!
I always like to hear from you guys so tell me something good in the comments!
Hey! You should follow me on Twitter because reasons: https://twitter.com/FlippedCoding
Oldest comments (33)
Love the graphic! Reminds me of the relationship between squares and rectangles.
Amazing clarification. Thank you..
Always wondered. Would have been nice to have seen some examples too :)
dev.to → URI
dev.to with protocol (https, ftp) → URL
tools.ietf.org/html/rfc3986#sectio...
dev.to is not a URI, it is just a domain name.
URI's must start with a scheme (e.g. file, http, ftp) as specified in section 1.1.1 of the RFC you linked to.
A scheme may or may not be associated with a protocol which is where your confustion may be coming from. For instance the schemes 'http' and 'ftp' are clearly associated with the HTTP and FTP protocols, whereas the 'file' scheme is not associated with any protocol.
Hm yes, correct. I think I confused myself :D
Sorry.
If "Your Name" can be an URI, any domain name is an URI too, yes?
Ran into this exact question a month ago. Your explanation is way easier than what I could find then.
thanks
imho about the use of terms:
w3c allows to use both variants without a difference
w3.org/TR/uri-clarification/#recom...
You could also say that the URL is that part of the URI that never changes, right?
Example:
example.com/Project/users/1
example.com/Project/posts
In this case, the URL is “www.example.com/Project”.
Correct me if I’m wrong!
By the way, nice article!
They are both URIs but not URLs, because you do not know where to find them. To be a locator I think you need to specify where I can find it, in this case it should have a protocol.
Hmm, that makes sense. So my affirmation would be valid if I added the protocol to both of them?
What is an example of an URI that is not an URL?
Here's a URI that's not a URL:
example.test.com
The reason that this is not a URL is because this system could respond to different protocols.
This URI could have a URL like any of these:
ftp://example.test.com
example.test.com
example.test.com
Hopefully that makes sense!
I don't think
example.test.com
is a valid URI. In RFC3986:URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
And it didn't say anything about that schema can be ignored. Also ":" seems to be necessary in the definition. Am I thinking wrong?
mailto:email@domain.com
would be an URI but not a URL.For exaples and a more detailed analysis pertaining the origins and sometimes religious distinction betweeen URI, URL and URN can be found here: danielmiessler.com/study/url-uri
Inclouding exerpts of the RFCs that outlined these terms.
The tenth time I've looked up this distinction. Thanks!
This was helpful explanation. Exactly what I needed. Thank you!.