URL vs URI

URL vs URI: Most important Differences & Full Form You Must Know

Where can I find the URL?
A uniform resource locator, or URL, is a global address that can be used to retrieve resources from within a computer network. URLs are most commonly mentioned in connection with web pages (HTTP), but they are also applicable to database access via JDBC, email (mailto), file transfer (FTP), and a wide variety of other applications. Uniform Resource Locator is the full form of the URL abbreviation.

What is URI?

A uniform resource identifier, or URI, is a string of characters that can be used to identify either a physical or logical resource. In order to maintain consistency, URIs must adhere to certain syntax rules. In addition to that, it keeps its extensibility by utilising a naming structure that is hierarchical. Uniform Resource Identifier is what a URI is abbreviated to when it’s in its full form.

Ven Diagram of URIs and URL

As can be seen in the illustration to the right, there are two distinct varieties of URI:

The Uniform Resource Locator (URL) identifies a location on the internet as well as a method for retrieving information from that location.

The Uniform Resource Name, also known as URN, is a resource on the internet that specifies the URN scheme.
URIs and URLs Compared in a Venn Diagram

Syntax of URL

Because it identifies you, “your name” has the potential to serve as a URI, as demonstrated in the diagram that was just presented. It is not possible to use that as a URL because it does not in any way help people locate your house.

On the other hand, “your home location” can be a URI or a URL. Both are acceptable. The reason for this is so that I can both identify you and provide you with a home location.

The syntax of the URL.

The following is an example of URL syntax:

http://www.domainname.com/folder-name/web page-file-name.htm

The URL that was just mentioned can be broken down into the following components:

It is the first part of the URL that is called the protocol. The protocol’s name in this context is the Hypertext Transfer Protocol (HTTP).

http://www.domainname.com/: It is the name of your website’s domain. In some circles, it is also referred to as the host or the server id.

/folder-name/ is a notation that the web page that was referenced in “filed” can be found on the webserver in a particular folder.

web-page-file-name.htm is the actual name of the file that represents the web page. The file has an extension of “.htm,” which indicates that it is a static web page. HTML files have this extension. It is possible for file names to have a variety of extension types; this is determined by the configuration of the web server. There is also the possibility that there will be no extension at all, and that the URL will simply end with a slash line (/).

Syntax of URI

This is an example of a URL that only contains a folder and not an extension.

https://career.guru99.com/category/heavy-industries/

This particular example URL does not have a folder.

https://www.guru99.com/what-is-sap.html

This particular example URL does not have an extension.

https://career.guru99.com/top-33-investment-banking-interview-questions-answers/

The syntax of the URI.

The following is an example of URI syntax:

[/authority] URI = scheme: [/URI]

path[?query]

[#fragment]

Confusion about URN

It is a non-empty component that is followed by a colon and is called a scheme component (:). A scheme is a string of characters that begins with a letter and can be followed by any combination of digits, letters, hyphens, periods, or plus signs (+). The terms “HTTP,” “HTTPS,” “mailto,” “file,” and “FTP,” among others, are all examples of well-known schemes. The Internet Assigned Numbers Authority must first be notified of any changes to a URI scheme (IANA).

The component of authority is: It is a field that you can skip and it has a / in front of it. It is comprised of

Subcomponent of user information that can be optional and may include a username and a password (optional).

A subcomponent of the host that can contain either an IP address or a registered name.

A subcomponent of the port that is not required and is followed by a colon (:)

Path: A path is made up of a series of segments that are delineated from one another using slashes.

Query component: It is not required, and it is denoted by a question mark (?) in front of the phrase. A query string that does not contain hierarchical data is contained within the Query component.

The fragment component is denoted by a hash sign (#) and is a field that is not required to be filled out. A fragment identifier that points in the direction of a secondary resource is contained within a fragment component.

Exemplification of a URI

Why URL?

No protocol mentioned

www.guru99.com

Not to be mentioned domain

what-is-sap.html

Protocol mentions

ldap:/[2001:db8::7]/c=GB?objectClass?one

mailto:abc@example.com

tel:+1-816-555-1212

telnet:/192.0.2.16:80/

Confusion regarding the URN

There is some misunderstanding regarding URN in that, if you implement protocols such as HTTPS, FTP, and so on, then it is called a URL, even though it is actually a URI. This leads to some confusion.

The difficulty with holding such a discussion is that the relevant RFC are not only very complicated but can also be contradictory at times. For instance, the RFC 3986 specifies that a URI may either be a name or a locator, or both.

Why URI?

The following is a list of the most important advantages of using URL:

Because of the information that is written in the URL, you now have the ability to navigate from one web page to another with just the click of your mouse.

A resource’s uniform resource locator (URL) will tell you how to access it.

When you type a URL into your browser or click on any hypertext link, your web browser will send a request to a web server to download one or more files. This request will be sent whenever you type a URL into your browser.

A uniform resource locator, or URL, is the address of a specific page, image, file, piece of media, or application that is hosted on the World Wide Web.

One of the most important aspects of your website is its address, also known as its domain name. You could drive traffic to your website by using simple words or strings that typically end with a.org,.com, or.net at the end. This would allow you to achieve your goal.

Why use a URI?

The following is a list of the most important advantages of using URI:

Because it eliminates the possibility of confusion, a Uniform Resource Identifier is an indispensable component of the semantic web.

A uniform resource identifier (URI) looks up both the name and location of a resource or file and returns the results in a standard format.

It consists of a string of characters that represents the particular filename and path.

A universal resource identifier, or URI, is a string that can be used by other systems to access resources via the World Wide Web or an internal network. Web browsers and software that facilitates peer-to-peer file sharing (also known as P2P) use it to locate and download files.

URI makes it possible to define new file types without having an effect on the existing files you have.

You are able to associate a single resource with multiple representations by assigning it to them.

URL Vs. URI

Here are the main differences between URL and URI:

URL URI
URL stands for Uniform Resource Locator. URI stands for Uniform Resource Identifier.
URL is a subset of URI that specifies where a resource is exists and the mechanism for retrieving it. A URI is a superset of URL that identifies a resource either by URL or URN (Uniform Resource Name) or both.
The main aim is to get the location or address of a resource The main aim of URI is to find a resource and differentiate it from other resources using either name or location.
URL is used to locate only web pages Used in HTML, XML and other files XSLT (Extensible Stylesheet Language Transformations) and more.
The scheme must be a protocol like HTTP, FTP, HTTPS, etc. In URI, the scheme may be anything like a protocol, specification, name, etc.
Protocol information is given in the URL. There is no protocol information given in URI.
Example of URL: https://google.com Example of URI:
urn:isbn:0-486-27557-4
It contains components such as protocol, domain, path, hash, query string, etc. It contains components like scheme, authority, path, query, fragment component, etc.
All URLs can be URIs Not all URIs are URLs since a URI can be a name instead of a locator.