The internet places a plethora of resources and information at our fingertips. However, it’s essential to understand how to identify and retrieve them. To do that, we can use URIs and URLs. While you’re probably familiar with the latter term, you might be wondering, “what is a URI?” Often, networking tools around the web use this term, confounding users who haven’t come across the acronym before.
In this post, we’ll explain what a URI is. We’ll discuss if a URI is different from a URL, break down its various components, and explore its different use cases. Let’s jump in!
What Is a URI?
A Uniform Resource Identifier (URI) is a string of characters used to identify a resource. We can utilize a URI to pinpoint a website, file, or even a specific piece of data. It is an umbrella term, under which various other locators fall.
There are many different types of URIs, but the most common one is the Uniform Resource Locator (URL) , such as https://www.elegantthemes/, as you can see below:
The URL is a specific type of URI that locates a specific website on the internet. In this case, the Elegant Themes home page. It is a URL because it includes both the name of the resource (elegantthemes.com) and the pathway to get there (https://).
URLs are typically associated with websites. However, we can also use different URI formats to locate files and other resources, such as email addresses or phone numbers.
Some additional examples of URI formats include:
In these examples, the URI would use an ftp:// protocol if the resource were a file. Furthermore, it would utilize mailto: for an email address.
Other types of URIs are Uniform Resource Names (URNs) and Uniform Resource Citations (URCs). URNs are identifiers for published documents. By contrast, URCs are designed as identifiers for specific pieces of data.
An example of a URN would be urn: ISBN 978-0-87779-636-7. You would use this URN to identify the paperback version of The Merriam-Webster Dictionary, Newest Edition by its International Standard Book Number (ISBN):
The ISBN is a URI that uniquely and globally names a book. It can help users verify they’re getting the correct version or edition of a printed resource that they want.
What Is a URI Fragment?
A URI is a compact sequence of characters identifying an abstract or physical resource. Moreover, there is a handful of components that make up a URI.
Below is the basic syntax of a URI:
URI = scheme:[//authority]path[?query][#fragment]
That looks pretty complicated, but it’s really pretty simple. So let’s take a closer look at what each of these elements means:
- Scheme: The protocol you use to interact with the resource, such as “https”
- Authority: The host and port information
- Path: Typically a sequence of segments separated by slashes (e.g., /blog/posts/new-recipes)
- Query: An optional string that contains a series of attribute-value pairs preceded by a question mark
Another essential component is a URI fragment. This is an optional and additional identifier that uses the hash sign (“#”) to jump to a particular part of the page. In HTML, you can append this fragment to a URL to locate a specific section of a page or document, known as the “fragment identifier”. You can do this by utilizing the value of the element’s id attribute.
For instance, you could use https://www.website.com/blog/postname#top to navigate to the top of a blog post. Or maybe you would use #pricing to direct users directly to the pricing table on a longer features page.
Let’s say you have a page on your website, and you utilize the tag to identify the FAQ section of your page . In this scenario, you can use https://www.website.com/about.html#faq to go directly to the relevant section. You would just need the FAQ container to have as a CSS selector .
Is a URI the Same as a URL?
As mentioned, a URI is a character sequence used to identify a resource. While there are different types of URIs, URL is the most common one.
All URLs are considered URIs. However, not all URIs are URLs.
The main difference between the two resource sequences is that URIs identify and URLs locate. We use a URL to find web pages and URIs to identify HTML, XML, and other files .
A URI can identify resources by the name, location, or both. However, URLs specify the resource and how to reach it on the internet.
How Are URIs Used?
You should consider utilizing a URI whenever you need to identify a resource. However, there isn’t one specific way to use a URI. The most suitable type will depend on the resource and the context in which you want to access it.
For example, if you need to locate an internet-based resource such as a website, you’ll typically use a URL. This process would involve typing the URL into your web browser’s address bar, including https://, and then pressing Enter.
When discussing website domains , such as elegantthemes.com, it’s best to use a URL because it’s more specific (which is why it has become the default internet navigation). It provides the resource name and location.
Alternatively, suppose you were using a URN to identify a book. In that case, you might include it in a citation for that body of work. A URN can identify a resource by a unique name. However, it doesn’t necessarily tell you how you can locate it.
On the other hand, you can use URCs to identify the metadata of a document rather than the actual document.
For example, you could use a URC to point to the HTML source code of a page. In this case, it might look like view-source:https://example.com/ in your browser bar. It would take you directly to the page code for that URL.
The internet enables us to find and locate a wide range of resources. While most users are only familiar with the URL structure, URIs in general give you access to anything from books to websites and even specific datasets and codebases. However, the protocols and methods we use to identify and access these materials depend on their formats and contexts.
As discussed in this article, a URI is a character sequence that lets you identify a website, file, or specific piece of data. It is an umbrella term for various locator fragments. The most common URI is a URL, which locates web addresses. However, there are also URNs, which can identify other types of resources like books, and URCs can pinpoint specific data points.
We know that URIs can be dense subject matter, so do you have any questions about what a URI is? Let us know in the comments section below!
Featured image via Overearth / shutterstock.com