Difference Between URL and URI
Last Updated :
26 Feb, 2024
In Web browsers and Internet connections, it is important to understand the difference between a Uniform Resource Identifier (URI) and a Uniform Resource Location (URL). Both URIs and URLs are pointers to things like web pages, images, documents, or other online content. However, they have distinctive characteristics and functions that set them apart from one another.
What is URL (Uniform Resource Locator)?
URL (Uniform Resource Locator) is often defined as a string of characters that is directed to an address. It provides a way to retrieve the presentation of the physical location by describing its network location or primary access mechanism.
To locate a resource on the internet, use a Uniform Resource Locator or URL. It serves as both a resource reference and an access point. A unique resource—which could be an image, an HTML page, a CSS document, or anything else—is always displayed by a URL.
URL
The protocol is described within the URL which is employed to retrieve the resource and resource name. The URL contains http/https at the start of the resource may be a web-type resource. Similarly, it begins with ftp FTPf the resource may be a file and mailto if the resource is an email address. The syntax of a URL is shown below where the primary part is employed for protocol and the remainder of the part is employed for the resource which consists of a website name or program name.
https://www.geeksforgeeks.org/minimum-cost-graph
Here, the domain name describes the server (web service) and program name (path to the directory and file on the server).
Syntax of URL
Every HTTP URL adheres to its generic URI's syntax. As a result, the syntax of the URL and the URI are comparable. It is provided below:
- Scheme: A scheme is the initial part of a URL; it is a protocol that a browser must employ in order to seek a resource. HTTP and HTTPS are the protocols that are most often used for websites.
- Authority: The domain name and port, two sub-components of the authority, are separated by a colon. The resource's registered name, such as javatpoint.com, can be used as the domain name, and the port on a web server serves as the technical entry point to the resource. For HTTP, port 80 is used, and for HTTPS, port 443.
- Path: The path on the web server shows the full route to the resource. A possible format is /software/htp/index.html.
- Query String: The string containing the name and value pair is known as the query string. When it appears in a URL, the information is provided by following the path component. "?key1=value1&key2=value2" is one example.
- Fragment: It is an optional element that comes before the hash(#) symbol. It is made up of a fragment identification that points the way to a backup resource.
- For Ex: https://www.geeksforgeeks.org/difference-between-url-and-uri/
What is URI (Uniform Resource Identifier)?
Similar to URL, URI (Uniform Resource Identifier) is also a string of characters that identifies a resource on the web either by using location, name or both. It allows uniform identification of the resources. A URI is additionally grouped as a locator, a name or both which suggests it can describe a URL, URN or both. The term identifier within the URI refers to the prominence of the resources, despite the technique used.
The former category in URI is URL, during which a protocol is employed to specify the accessing method of the resource and resource name is additionally laid out in the URL. A URL may be a non-persistent sort of the URI. A URN is required to exist globally unique and features a global scope.A string identifier that points to an online resource is called a URI, or uniform resource identifier. Any resource on the internet can be identified by this string of characters by either its name, its location, or both. Scheme, authority, path, query, and fragment are all contained in a URI. The most widely used URI systems include ftp, Idap, telnet, HTTPs, HTTP (Hypertext Transfer Protocol), etc.
Syntax of URI
- Scheme: A scheme is the initial part of a Uniform Resource Locator (URI). It consists of a string of characters, which can be any combination of a letter, number, plus sign, or hyphen (_), and is followed by a colon (:). The most widely used protocols are irc, file, ftp, data, and http. It is necessary to register the schemes with IANA.
- Authority: Two slashes (//) come before the optional authority component. There are three smaller parts to it:
- user details: It might have a colon (:) between the username and an optional password.
- host: It has an IP address or a registered name on it. The IP address has to be put in square brackets [] around it.
- Path: Optional
- Port: A series of path segments divided by a slash(/) make up this path. It is always supplied by the URI; however, the path may be null or empty.
- Query: It is an optional element that comes before the question mark (?). It has a non-hierarchical query string with data in it.
- Fragment: It is an optional element that comes before the hash(#) symbol. It is made up of a fragment identification that points the way to a backup resource.
Difference Between URL and URI
URL | URI |
---|
URL is used to describe the identity of an item. | URI provides a technique for defining the identity of an item. |
URL links a web page, a component of a web page or a program on a web page with the help of accessing methods like protocols. | URI is used to distinguish one resource from other regardless of the method used. |
URL provides the details about what type of protocol is to be used. | URI doesn’t contains the protocol specification. |
URL is a type of URI. | URI is the superset of URL. |
It comprises of protocol, domain, path, hash, and so on. | It comprises of scheme, authority, path, query and many more. |
Ex-https://www.geeksforgeeks.org/ | Ex- urn:isbn:0-294-56559-3 |
What is a URN?
A Uniform Resource Name (URN) is a kind of Uniform Resource Identifier (URI) this is used to uniquely perceive resources at the net in a chronic and region-unbiased way. Unlike Uniform Resource Locators (URLs), which specify the location of a useful resource and how to get right of entry to it, URNs are meant to function continual, globally specific identifiers for sources irrespective of their contemporary region.
The primary reason of URNs is to provide a strong and lengthy-lasting identifier for resources, even supposing their place or access strategies trade over time. URNs are normally used for naming sources which includes documents, articles, books, and other types of virtual content.
Comparison Between URL vs URI vs URN
- Purpose: URIs are used to perceive sources at the net, at the same time as URLs specify the area and get admission to method for getting access to sources, and URNs provide persistent, place-impartial identifiers.
- Structure: URLs include the network location and access protocol, whilst URNs consist of a scheme and unique identifier for the resource. URIs encompass both of these systems.
- Usage: URLs are normally used to get admission to web pages and resources without delay, whilst URNs are less normally used however provide stability and patience for useful resource identity. URIs function the overarching term that consists of each URLs and URNs.
Similar Reads
Difference between URL and Link
When you are searching for information on the web, you frequently use terms like URL and link. Also, these two terms can be explained in terms of one another, as they are not defined in the same way. While a URL (Uniform Resource Locator) is the address of a resource on the web, a Link (or Hyperlink
5 min read
Difference Between URI and URN in Java
URI stands for Uniform Resource Identifier. It identifies the resource either by name, or by location, or by both. It allows uniform identification of the resources. Here the resource can be anything like documents, images, files, web pages, etc. that can be part of the web architecture. The identif
2 min read
Difference Between URL, URI and URN in Java
URI stands for Uniform Resource Identifier. URI is a sequence of characters used to identify a resource location or a name or both over the World Wide Web. A URI can be further classified as a locator, a name, or both.Syntax of URI: Starts with a scheme followed by a colon character, and then by a s
2 min read
Difference Between WLAN and Wi-Fi
Networking of computers is a interconnection of computer devices that can exchange data and share resources with each other. These devices use some set of communication rules known as protocols to send or receive information over physical or wireless technologies. What is WLAN? WLAN full form is Wir
3 min read
Difference between Wuala and pCloud
1. Wuala : Wuala was a file synchronization service, file storage service, file versioning service and backup storage service which was originally provided by Caleido Incorporation but was later owned by Seagate Technology. It was developed by Dominik Grolimund and Luzius Meisserin. It was majorly d
2 min read
Difference between Wasabi and Wuala
1. Wasabi : Wasabi is a file hosting and cloud storage service which is provided by Wasabi Technologies Incorporation. It is a object storage service. It was launched by Wasabi Technologies Incorporation in 2017. It does not offer free storage space. It offers unlimited maximum storage space for pai
2 min read
Difference between API and GUI
1. Application Programming Interface (API) : API stands for Application Programming Interface which is a collection of communication protocols and subroutines used by various programs to communicate between technology products such as applications and websites. Features of API: Programmable: An API
3 min read
Difference between CLI and GUI
A Command Line Interface (CLI) and a Graphical User Interface (GUI) are two distinct methods for interacting with computer systems and software. CLI allows users to execute commands by typing them into a terminal or console providing precise control and efficiency but requiring knowledge of command
4 min read
Difference Between URL and URN in Java
URL stands for Uniform Resource Location. A URL contains a protocol, server name or IP Address, Port Number, filename, or directory name. URL is a subset of URI as perceived from the image shown below that describes the network address or location where the source is available. URL begins with the n
3 min read
Difference Between Domain Name and URL
In the world of the internet and websites, Domain Name and URL are very common terms and are used interchangeably, but there is a lot of difference between these two terms. In this article, we will learn what the difference is between a domain name and a URL.What is a Domain Name?It is very hard to
6 min read