Uri

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 7

URI

What is a URI?
A URI — short for “Uniform Resource Identifier” — is a sequence of characters that
distinguishes one resource from another.
A URI or a uniform resource identifier is a string of characters that generally identifies any
web resource by using a name, a location, or both.
For example, foo://example.com:8042/over/there?name=ferret#nose is a URI containing a
scheme name, authority, path, query and fragment.
Types of URI
There are two types of URIs: URNs and URLs
What is Uniform Resource Names (URNs)
A URN is a persistent and location-independent identifier that aims to identify a resource
permanently.
It means the resource remains valid even if its data is moved to another location
URN consists of at least three components:
1- URN – each URN uses the prefix urn: scheme specification.
2- NID – refers to a namespace identifier that should be registered in the Internet Assigned Numbers
Authority (IANA). This may include letters, digits, or a hyphen followed by a colon.
3- NSS – this is a namespace-specific string that identifies the internet resource.
It may contain ASCII codes, digits, punctuation marks, and special characters.
For Example: urn:isbn:0405999832 identifies a book by using the ISBN numbers.
Uniform Resource Locators (URLs
A URL or Uniform Resource Locator is used to find the location of the
resource on the web. It is a reference for a resource and a way to access
that resource.
A URL always shows a unique resource, and it can be an HTML page, a CSS
document, an image, etc.
A URL uses a protocol for accessing the resource, which can be HTTP,
HTTPS, FTP, etc.
It is mainly referred to as the address of the website, which a user can
find in their address bars. An example of an URL is given below:
scheme:[//authority]path[?query][#fragment]
Syntax of URL

The above URL is made up of the following components:


Scheme: The URL's first component is a scheme, which represents a protocol that a browser must
need to use to request the resource. The commonly used protocols for websites are HTTP or
HTTPS.
Authority: The authority includes two sub-components, domain name and Port, separated by a
colon. The domain name can be anything, the registered name of the resource
like youtube.com, and port is the technical gate to access the resource on a webserver. The port
number 80 is used for HTTP and 443 is used for HTTPS.
Path: The path indicates the complete path to the resource on the webserver. It can be
like /software/htp/index.html.
Query String: It is the string that contains the name and value pair. If it is used in a URL, it follows
the path component and gives the information. Such as "?key1=value1&key2=value2".
Fragment: It is also an optional component, preceded by a hash(#) symbol. It consists of a
fragment identifier that provides direction to a secondary resource.
Differences Between URI and URL
URI URL
URI is an acronym for a Uniform URL is an acronym for a Uniform
Resource Identifier. Resource Locator.

URI is the superset of a URN and a


URL is the subset of URI.
URL.

URI identifies a resource and


URL identifies the web address or
differentiates it from others by
location of a unique resource.
using a name, location, or both.
URI contains components like a URL has similar components to a
scheme, authority, path, and URI, but its authority consists of a
query. domain name and port.

An example of a URI is ISBN 0-476- An example of a URL would


35557-4. be https://hostinger.com.

URL is mainly for searching web


URI is usually used in XML.
pages on the internet.

URI scheme can be a protocol, a


URL scheme is a protocol, such as
specification, or a designation like
HTTP and HTTPS.
HTTP, file, or data.

You might also like