URL, URI, URN: what’s the difference?
You’ve probably heard the acronyms URI, URL, and URN thrown around a lot if you work near a computer. Many are familiar with these terms but don’t really know what they mean. Often they are even used interchangeably which is not accurate, but if you’ve done this before there is no need to worry because I’m here to set the record straight. I’m not a developer but I do work in a tech space and there are so many little things that can be confusing for those who don’t have extensive knowledge on what really goes into building and maintaining a website. I have made it my mission to educate myself (and you in the process) on these fundamental topics.
Uniform resource locator (URL) and uniform resource names (URN) are both technically subsets of uniform resource identifiers (URI). A URI is a string of characters used to identify a resource either by name or location (or both) on the internet, so a URL refers simply to the location of the resource itself while the URN refers to the resource’s name. That then means that if you wanted to search a resource based on both its name and its location, you would search for a URI. To sum it up, URLs and URNs are both URIs but as we’ve learned these three terms are not interchangeable and represent different characteristics of a resource. You may be wondering why this matters. It is very important to understand the distinction as multiple resources could have the same name so using a URN wouldn’t be very effective in locating the resource you’re looking for. This is the reason that using URLs is much more common as they are used to access web pages, while URNs are used for other types of media. When you type in a URL in your search bar, you’re sending a request to the server at that address. In just a few seconds, the server responds to your request with the contents of the resource you sent for. This is one of the fundamental processes on the internet. URLs allow for creating links between pages and provide unique identifiers for each one, so they can help developers stay organized and help users find exactly what they’re looking for with ease as well.
A URL will always contain a protocol and a domain but can also have other information that leads to more precise areas of a website. This is an example: http://www.portfolio-by-madeline.com/blog. There are a few other identifiers that can follow a domain such as the port, the path, query strings, and fragments but I’ll save that for another blog post. URNs are permanent and unchanging so they are important for resources that you want to identify even if the resource moves. The three parts of the URN syntax include the case-sensitive leading scheme followed by a namespace identifier (NID) which identifies where a resource belongs, then a namespace specific string (NSS) which serves to identify the resource itself. Here’s an example: urn:oid:2.16.840. URNs are used only to identify what a resource is, not where it is and will always remain the same even if a resource changes location or becomes inactive. Since URNs are meant to be unique their persistent identifiers (NID) must be registered with the Internet Assigned Numbers Authority. The main use case for URNs is libraries or journals to identify specific books, articles and other content.
Whether you’re sending an email, transferring a file or accessing a webpage we need URIs to do so. It’s important to understand how the internet really works if you want to become a developer, work in a tech space, or simply want to stay on top of things.