URL vs URI vs URN: The Science Behind The Terms
Quick, what’s the difference between a URL and a URI? What about a URI and a URN? If you’re just a regular person, with no passion for computers, and you don’t know the answer, it’s not that big of a deal; however, if you’re an aspiring web developer or a network administrator and don’t know the difference between the three, you’d better read this right away, before anyone finds out.
Leaving the joke aside, I’ll be brutally honest and tell you right from the start: if you’re just the casual web surfer type, learning about Internet terminology might not be of much real use to you, except maybe to impress your non-technical-savvy friends over a beer at the pub. However, if you’re a web developer, learning the difference between a URL, a URI, and a URN can be quite useful on the long run, and also serve as a good starting point prior to taking an online course and becoming a professional web developer.
The Three “U”s
Techie or not, I’m sure the term URL is familiar to you. You may know it as “the address you type into the browser to go to a specific page.” In fact, that’s pretty much what URL stands for: Uniform Resource Locator; simply put, a URL is the address where a certain resource can be located.
URN stands for Uniform Resource Name and, as you can already guess, it provides the name of the resource in question. A URN does not provide any means to locate the resource, but it does have one distinctive feature: it is completely unique across space and time.
The third U –URI – stands for Uniform Resource Identifier, which can be a URL, a URN, or a combination of the two.
It is important to note that, while URLs will always serve as URIs, the other way around is not always applicable.
Theory alone can be quite confusing, so let us look at some practical examples that will help you understand the differences and the relationships between URLs, URIs and URNs.
Let’s say we have a person named John Smith that lives on 32 Grand Ave. The combination of name and address serves as a URI, as it allows us to easily identify our person. The address alone, which is the equivalent of the URL, is also a URI, as it allows us to know where to find the person, and thus identify it.
However, the name alone is not enough to identify the exact person, as there are dozens of people with the name John Smith. If the name was completely unique, thus resembling a URN, it would have given us a way of identifying the person and, while it wouldn’t give us an exact way of locating him, it would at least have made it possible to do so.
A better example of a URN is the ISBN code of a book: while it doesn’t tell you in which library to find the book, it does provide you with some exact details about it, which will ultimately allow you to locate it.
Take the Udemy Blog page; if you have the name, Udemy Blog, simply searching by that term on Google won’t guarantee that what you find will be the legitimate page and not a clone, so it cannot be considered an accurate identifier.
If you have the URL, https://udemy.com/blog/, even if you don’t know where it points (though it is kind of obvious, in this case), accessing it will allow you to see the page and know what it is about, so the URL serves as an identifier.
URLs basically indicate what protocol needs to be used to access a certain resource, the http protocol being one of the most common protocols for accessing resources over the internet. You can learn more about this protocol by taking this online course.
Keeping it simple
In order to easily make a difference between the three elements, here are a few simple things to remember:
- Every URL is a URI;
- Every URN is a URI;
- URI and URL are NOT interchangeable – a URL is a URI, but a URI is not always a URL;
- URLs always contain an access mechanism.
There are various access mechanisms a URL can use, depending on the type of resource and its location. Besides the popular http mechanism, which is specific for webpages, ftp is also a popular mechanism, used mainly for file access on a local network or via the Internet. You can learn how to master ftp from this free online course, and read how ftp file backups can keep your precious data safe.
You should now have a pretty good understating of what is what, and at this point you may be wondering why people don’t just use URLs all the time, as they are the most useful of the three elements. The answer is simple – because sometimes doing so would just complicate things.
To understand what I’m talking about here, just imagine this simple scenario: you’re writing a piece of code which, for a certain function, needs to make sure a file is present. The first thing that may come to mind is to simply provide the location of the file, so the code can see that it is there, and thus perform the function you wanted; but what if you need to change the location of the file? The code won’t find the file, and thus it won’t perform the function you wanted it to perform; the simpler approach would be to just make the code check whether the file is present or not, regardless of its location, and then proceed with the function. This is a fairly rudimentary example, but you get the idea – using an identifier instead of a locator can simplify things in certain situations. This is a fairly common situation in Java programming for example. You can learn more about java programming from this online course.
As if there wasn’t enough confusion between URLs and URIs already, modern technology made it even easier for these terms to get mixed up. Most web browsers now have a smart address bar, which doesn’t just act as an address bar, but also acts as a search box; this means that, even if you don’t know the exact URL of a webpage, if you type something that can be interpreted as a URI, the browser will either automatically come with a suggestion or perform a web search, and most probably find exactly what you were looking for.
This makes things a lot easier for non-technical people that may find it hard or inconvenient to memorize an entire URL. Because this intuitiveness is not present when you’re setting up a server, for example, so you will still need to know when and how to use URIs and URLs. Be that as it may, these tasks are still fairly simple, as you only need to take an online course to learn how to manage an SQL server or even how to build up your own cloud server from scratch.
URNs don’t get a whole lot of attention nowadays because they are not very common, as they were initially developed to be used as part of an Internet architecture that never saw the light of the day. Instead, URNs are now used for a limited range of applications, mainly because they are very rigid and regulated.
So there you have it, the three big Us, explained.
Computer Skills students also learn
Empower your team. Lead the industry.
Get a subscription to a library of online courses and digital learning tools for your organization with Udemy for Business.