Milecia
Posted on • Updated on
#webdev #beginners #internet
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
Top comments (33)
Subscribe
JavaScript Joel
JavaScript Joel
Cofounded Host Collective (DiscountASP.net). Cofounded Player Axis (Social Gaming). Computer Scientist and Technology Evangelist with 20+ years of experience with JavaScript!
-
Joined
• Oct 11 '18
- Copy link
Always wondered. Would have been nice to have seen some examples too :)
manuel
manuel
I’m known as mnlwldr on various platforms. I’m a software developer and live in the southwest of Germany near the France border.
-
Location
Germany
-
Work
Software Developer
-
Joined
• Jun 25 '19 • Edited on Jun 25 • Edited
- Copy link
dev.to → URI
dev.to with protocol (https, ftp) → URL
Dorian Peake
Dorian Peake
-
Joined
• Jul 7 '19
- Copy link
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.
manuel
manuel
I’m known as mnlwldr on various platforms. I’m a software developer and live in the southwest of Germany near the France border.
-
Location
Germany
-
Work
Software Developer
-
Joined
• Jul 8 '19
- Copy link
Hm yes, correct. I think I confused myself :D
Sorry.
kulcsar-bence
kulcsar-bence
-
Joined
• Jan 13 '20 • Edited on Jan 13 • Edited
- Copy link
If "Your Name" can be an URI, any domain name is an URI too, yes?
Andy Zhao (he/him)
Andy Zhao (he/him)
uh oh where'd my bio go!
-
Education
Actualize Coding Bootcamp
-
Joined
• Oct 11 '18
- Copy link
Love the graphic! Reminds me of the relationship between squares and rectangles.
tymlim96
tymlim96
-
Work
Unemployed
-
Joined
• Jun 9 '21
- Copy link
Thank you very much for this post! It definitely clears up a lot on the difference between these two terms. I find it's really important to get the terms right, just so I don't confuse others when explaining my code :)
Andrei Gatej
Andrei Gatej
-
Email
andreigtj01@gmail.com
-
Location
Romania
-
Joined
• Oct 13 '18
- Copy link
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!
Adrian B.G.
Adrian B.G.
Striving to become a master Go/Cloud developer; Father 👨👧👦; 🤖/((Full Stack Web|Unity3D) + Developer)/g; Science supporter 👩🔬; https://coder.today
-
Email
adrian@coder.today
-
Location
E EU
-
Education
Bachelor of Economic Informatics
-
Work
Cloud Engineer at CrowdStrike
-
Joined
• Dec 31 '18
- Copy link
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.
Andrei Gatej
Andrei Gatej
-
Email
andreigtj01@gmail.com
-
Location
Romania
-
Joined
• Jan 3 '19
- Copy link
Hmm, that makes sense. So my affirmation would be valid if I added the protocol to both of them?
Christopher Broderick
Christopher Broderick
-
Joined
• Feb 25 '20
- Copy link
There is no formal differentiation that is definitive.
This comes the closest to explaining the difference:
tools.ietf.org/html/rfc3305#sectio...
... and basically states they are ALMOST equivalent ... but not quite.
The entire RFC3305 is about the confusion about URI, URL and URN and the conclusion is that there needs to be work done to clarify the confusion:
tools.ietf.org/html/rfc3305#section-5
Saad BENBOUZID
Saad BENBOUZID
about.me/saad.benbouzid
-
Location
Geneva, Switzerland
-
Work
Java Software Designer at Geneva
-
Joined
• Sep 25 '19
- Copy link
you have to reverse URL and URI in your graph example.
If I'm reading you correctly, URI (Name) is a subset of URL (Name + location), so the shapes should be the other way round : URL should wrap URI and not the opposite.
Why am I the first one to notice ?
Enrique Avila
Enrique Avila
-
Joined
• Sep 28 '19
- Copy link
You are wrong... commons.wikimedia.org/wiki/File:UR...
Elarcis
Elarcis
“As much as I’d love our code to be fully compliant with the great programming practices of this world, I’d rather have it working — if possible before the heat death of the Universe.”
-
Location
Lyon, France
-
Education
Software engineer
-
Joined
• Oct 13 '18
- Copy link
What is an example of an URI that is not an URL?
Milecia
Milecia
Starting classes soon! | Software/Hardware Engineer | International tech speaker | Random inventor and slightly mad scientist with extra sauce
-
Location
Under a rock somewhere
-
Work
Senior Software Engineer / Random Tech Enthusiast
-
Joined
• Oct 16 '18
- Copy link
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!
Vibert Thio
Vibert Thio
Artist | AI | Programmer
-
Joined
• Aug 30 '19
- Copy link
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?
Ilán Vivanco
Ilán Vivanco
-
Location
Santander, Spain
-
Work
Senior web developer at NTMatter
-
Joined
• Mar 12 '20 • Edited on Mar 12 • Edited
- Copy link
mailto:email@domain.com
would be an URI but not a URL.
Dan Dascalescu
Dan Dascalescu
Developer advocate, full-stack engineer, startup co-founder & CTO, bringing 15 years of experience in Silicon Valley, including at Google and Yahoo!. Public speaker.
-
Location
🌐
-
Education
UC Santa Cruz Extension
-
Work
Developer Advocate at Weaviate, the open-source semantic search engine
-
Joined
• Apr 12 '20
- Copy link
Not clear at all, in the context of web development, sorry.
Examples would help, as well as breaking down URLs into their components.
Anyway, this is not a topic worth writing a new post about. There are canonical explanations, such as the one over at Webmasters.
jules manson
jules manson
Mechanical engineer who dabbles with Vanilla Javscript and web development as a hobbby. I don't use any libraries or frameworks as they take the fun out creating your own solutions.
-
Location
Los Angeles
-
Education
Engineering, Physics, and Math
-
Joined
• Dec 24 '19
- Copy link
Fantastic concept for a short article. I give it an A for effort but a D for execution. It provided no examples and based on the confusion lingering in the comments they could have cleared the confusion. It also left me pondering what some examples my look like.
Nopius
• Jan 9 '20
- Copy link
I refer to tools.ietf.org/html/rfc1630
page 2
URI:
The specification of the URI syntax does not imply anything aboutthe properties of names and addresses in the various name spaceswhich are mapped onto the set of URI strings. The propertiesfollow from the specifications of the protocols and the associatedusage conventions for each scheme.
URL:
URIs which refer to objects accessed with existing protocols are known as "Uniform Resource Locators" (URLs)
URI is just an abstract syntax to write down 'object reference' in universal way:
scheme:path
path not necessary starts with '//'
and 'scheme' is not necessary an existing protocol
URI, but not URL:
ssn:567-72-5098
Here is more explanation about URLs:
Specific Schemes The mapping for URIs onto some existing standard and experimental protocols is outlined in the BNF syntax definition. Notes on particular protocols follow. These URIs are frequently referred to as URLs, though the exact definition of the term URL is still under discussion (March 1993). The schemes covered are: http Hypertext Transfer Protocol (examples) ftp File Transfer protocol gopher Gopher protocol mailto Electronic mail address news Usenet news telnet, rlogin and tn3270 Reference to interactive sessions wais Wide Area Information Servers file Local file access
Jennifer Green
Jennifer Green
-
Joined
• Aug 23 '19
- Copy link
This was helpful explanation. Exactly what I needed. Thank you!.
Kingsley Aguchibe
Kingsley Aguchibe
I'm a computer science student and a web developer. I'm currently learning react.js
-
Joined
• Oct 11 '18
- Copy link
Amazing clarification. Thank you..
pyriel
pyriel
-
Joined
• Jul 3 '19
- Copy link
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.
Dan Dascalescu
Dan Dascalescu
Developer advocate, full-stack engineer, startup co-founder & CTO, bringing 15 years of experience in Silicon Valley, including at Google and Yahoo!. Public speaker.
-
Location
🌐
-
Education
UC Santa Cruz Extension
-
Work
Developer Advocate at Weaviate, the open-source semantic search engine
-
Joined
• Apr 12 '20
- Copy link
You're joking, right? Or spamming.
THIS is a clear, detailed explanation: webmasters.stackexchange.com/quest...
ninefivetwo
ninefivetwo
-
Joined
• Oct 11 '18
- Copy link
Ran into this exact question a month ago. Your explanation is way easier than what I could find then.
owaisakber
owaisakber
I'm a finance and accounting guy having much interest in programming and software development.
-
Location
Dubai
-
Work
Mr at Trading Company
-
Joined
• Sep 14 '19
- Copy link
Yes helpful article
View full discussion (33 comments)
For further actions, you may consider blocking this person and/or reporting abuse