URL expands to Uniform Resource Locator which is used for identifying a resource, and it is a subset of URI. URI (Uniform Resource Identifier) offers more simple and extendable way of identifying a resource.
The URL and URI can be differentiated with the fact that URI can represent the URL and the URN of the resource at the same time, but URL just can specify the address of the resource. URI is more common term as compared to URL and URN which are more limited in a sense.
Content: URL Vs URI
|Basis for comparison||URL||URI|
|Basic||URL provides a technique for describing an item's identity.||URI is used to define an item's identity.|
|Relationship||Type of URI.||Superset of URL|
|Protocol specification||Provided||No protocol information is given.|
Definition of URL
URL (Uniform Resource Locator) can be defined as a string of characters which refers to address. It is the most pervasively used way to locate resources on the web. It provides a method to retrieve the presentation of the physical location by describing its network location or primary access mechanism.
The protocol is described in the URL which is used to retrieve the resource and resource name. The URL contains http/https at the beginning if the resource is a web type resource. Similarly, it begins with ftp if the resource is a file and mailto if the resource is an email address. The syntax of an URL is shown below where the first part is used for protocol and rest of the part is used for the resource which consists of a domain name or program name.Here a domain name describes server (web service) or program name (path to the directory and file on the server). So a URL is used when we want to make a resource whether its web, file or email accessible through a browser.
Definition of URI
Similar to URL, URI (Uniform Resource Identifier) is also a string of characters which identifies a resource on the internet 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 means it can describe a URL, URN or both. The term identifier in the URI refers to the distinction of the resources, despite the technique used to accomplish the operation be it location, name or context. The former category in URI is URL, in which a protocol is used to specify the accessing method of the resource and resource name is also specified in the URL. A URL is a non-persistent type of the URI. Latter category of URI is URN which is persistent even when the resource becomes inaccessible. A URN is needed to exist globally unique and has a global scope.
The URI can also be translated from a non-network source hence it must contain characters that are most likely to be entered into a computer.
Key Differences Between URL and URI
- A URL (Uniform Resource Locator) is primarily used to link a web page, a component of a web page or a program on a web page with the help of the accessing method (protocols such as http, ftp, mailto) for retrieving the location of the resource. In contrast, URI (Uniform Resource Identifier) is used to define an item’s identity here the word identifier means to distinguish one resource from other regardless of the method used (URL or URN).
- A URL is a URI, but a URI can never be a URL.
- URL specifies, what type of protocol is to be used whereas URI doesn’t involve the protocol specification.
A URI is an identifier comprising a set of character, which permits uniform identification of resources by a uniquely specified extendable set of changing schemes (i.e. name, address, or context). On the other hand, URL is a subset of URI which describes a resource using one of the URI schemes (i.e. location).