Skip to main content
Post image
· 8 min read

The Important Differences between URI VS URL

Introduction

Finding a specific resource on the web can be difficult without a unique method or identifier. As a result, a man named Tim Berners-Lee coined the term "URI" to aid in identifying the location of a web resource quickly. With the introduction of URI, you can now find the location of any resource on the web regardless of where you are browsing from.

In this article, you will learn about the concept of a URI, its components, its architecture, and how it differs from a URL.

URI

URI is an abbreviation for "Uniform Resource Identifier," which refers to a unique identifier composed of a string of characters that points to any resource on the internet via procedures such as name, location, or both.

URLs and URNs are the two types of URIs. URLs (Uniform Resource Locators) are web addresses commonly known as website addresses. They specify the location of a resource on the Internet and instruct a web browser on how to retrieve it.

For example, the URI "https://www.example.com" specifies the location of a website and instructs a web browser to retrieve it using the HTTPS protocol.

Web protocols such as HTTP and HTTPS use URIs to communicate with multiple resources on the internet. The architecture of URIs is a string of characters that represents the address of a web resource, which is usually a combination of the resource's name and address.

In essence, a URI can identify any type of resource, including web pages, images, videos, and other types of files. They are an essential component of how the Internet works and are used in various contexts, including web addresses, links, and other types of references to online resources.

Components of URI

The URI architecture is made up of components. Each of these components serves a specific purpose, which includes the following:

  • Protocol: A protocol type must be specified before a URI can access a resource. Some of the existing protocols are as follows:
    • http://: This is the most widely used protocol on the Internet. It is an abbreviation for "HyperText Transfer Protocol," which is used to access resources on the internet via the HTTP protocol.
    • https://: This is similar to http://, but it encrypts the data being transferred using a secure connection (SSL/TLS).
    • mailto:: This protocol generates a link that launches the default email client and sends a new email message to the specified email address.
    • file://: This protocol is used to access files on the local computer.
    • ftp://:This protocol, which stands for "File Transfer Protocol," transfers files across a network.
  • Domain name: This is the unique name that identifies the website on the Internet.
  • Port number: This optional component specifies the port number used to access the resource.
  • Path: This specifies the location of the resource on the server.
  • Query string: This optional component specifies additional information to be sent to the server when requesting the resource.

Functions and Architecture of URI

A URI's architecture comprise several components, including the following:

  • Scheme: The scheme, also known as the protocol, specifies the type of resource being identified and how it should be accessed. For example, "http" and "https" are common schemes for webpages, whereas "ftp" is used for file transfers.
  • Authority: The authority, also known as the host, contains information about the host that serves the resource, such as the domain name or IP address. For example, in the URI "http://www.example.com," the authority is "www.example.com".


Examples of URI

Look at more examples of URIs with their representations as follows:

URI - https://www.debby.com:8080/path/to/resource?parameter=value Scheme: https Authority: www.debby.com:8080 Path: /path/to/resource Query: parameter=value

URI - ftp://ftp.debby.com/path/to/file.txt Scheme: ftp Authority: ftp.debby.com Path: /path/to/file.txt Query: None

Syntax Of URI

To better understand the components of URI, you need to understand the syntax. The syntax of a URI usually follows the order:

  1. Scheme: The first part of the URI is the scheme (or protocol), followed by a colon (:). For instance, "http:" or "ftp:".
  2. Authority: The next part of the URI is the authority, which can contain information about the host that serves the resource, such as the domain name or IP address. "www.example.com" or "192.168.1.1" are two examples.
  3. Path: The path represents the location of the resource within the authority and is denoted by a forward slash (/). "/path/to/resource," for example.
  4. Query: The query is represented by a question mark (?) and contains additional information passed to the resource. For example, "?parameter=value".

The different parts of a URI can be combined to form a complete URI as follows:

<scheme>://<authority><path>?<query>

Examples: http://www.debby.com/path/to/resource ftp://ftp.debby.com/path/to/file.txt mailto:user@debby.com Tel:+1234567890

It's important to note that not all URIs will have all components, and some may have additional components that are specific to the scheme.

Use Case of URI

URIs play a critical role in the functioning of the Internet because they provide a standard method for computers to locate and access resources. URIs are used in many applications and protocols to identify and locate resources on the Internet. Here are a few examples of common URI applications:

  • Webpages: One of the most common use cases of URIs is identifying Internet pages. URIs that start with "http" or "https" is used to access webpages and other website resources.
  • File transfers: URIs that start with "ftp" are used to transfer files between computers.
  • Email: URIs beginning with "mailto" are used to generate links that can be used to compose an email message.
  • Telephone calls: URIs that start with "tel" generate links that can be clicked to make a phone call.
  • Media streaming: URIs identify media files that can be streamed over the Internet, such as audio or video.
  • Database access: URIs identify database resources and provide a way for programs to access them.
  • Identifying resources in a distributed system: URIs are used to identify resources distributed across multiple servers or devices, such as files in a distributed file system or services running on a distributed computing platform.

URL

A URL (Uniform Resource Locator) is a type of URI (Uniform Resource Identifier) used to identify a resource's location on the Internet. A URL is a string of characters that specifies how to access a resource on the Internet, typically a webpage or other file.

A URL comprises several components, including the scheme, domain name, path, and query. The scheme, also known as the protocol, specifies the type of resource and how it should be accessed. "http" and "https" are common schemes for webpages, "ftp" for file transfers, and "file" for files on a local computer.

The domain name is the hostname or IP address of the server that hosts the resource. The path specifies the location of the resource on the server, and the query is used to provide additional information to the server.

Examples of URLs

A good example of a URL describing its syntax is as follows:

"http://www.example.com/path/to/resource?parameter=value#fragment". Scheme: "http" Authority: "www.example.com" Path: "/path/to/resource" Query: "parameter=value" Fragment: "fragment"

Other examples of a URl include:

In essence, a URL is a type of URI that allows you to find and access resources on the Internet. Web browsers, servers, and other software use it to retrieve and manage Internet resources.

Benefits of URI over URL

URIs (Uniform Resource Identifiers) are a broader classification of identifiers than URLs (Uniform Resource Locators). They have several advantages over URLs including:

  • Interoperability: URIs are more interoperable than URLs because they can be used across different systems and protocols. On the other hand, URLs are Internet-specific and are only used by web browsers and other Internet-based applications.
  • Namespace independence: URLs are specific to the Internet and use a specific naming scheme, such as the domain name system, whereas URIs are not tied to a specific naming scheme or namespace (DNS). This means that URIs can identify resources in any namespace, whereas URLs can only identify resources in the Internet namespace.
  • Abstraction: URIs are more abstract than URLs in that they identify a resource without specifying how to access it, whereas URLs do. This provides more flexibility in how the resource can be accessed.
  • Flexibility: URIs are more flexible than URLs because they can be used to identify any resource, whereas URLs are explicitly used to identify the location of a resource on the Internet.
  • Persistence: URIs are meant to be persistent, which means they should not change over time. However, URLs can change if the resource they refer to moves or the server's name or address changes.

discord banner

Conclusion

In summary, URIs are more versatile and flexible than URLs, and they are designed to be more persistent and interoperable. URIs are more general-purpose identifiers that can identify any type of resource, whereas URLs are limited to identifying a resource's location on the Internet.


Tags:


From Same Author

Software Engineer
How to use React Strict Mode in React 18
· 7 min read
Software Engineer
How to use Conditional Rendering in React
· 11 min read