Uniform Resource Identifier (URI
) is a string of characters that identify and provide a means to access a resource on the Internet.
URI
s serve as a unique identifier for resources such as web pages, files, or any other item that can be referenced or located. URI
s standardize and facilitate the identification and retrieval of resources across different systems and protocols. URI
s possess standardized syntax and formation for identification, enabling different systems and protocols to reference resources consistently.
URI
This example URI
can be broken down to illustrate the different components of a URI
:
http://203.0.113.15/some-page?name=<your_name>&age=<your_age>#some-section
The scheme defines the protocol or mechanism for accessing the resource. For example, https://
for web page(s) or ftp://
for file transfer, or mailto:
for email addresses. In our example, the scheme is http://
.
The authority specifies the domain or IP address of the server that hosts the resource. It may also include additional information such as usernames and passwords. In our example, the authority is 203.0.113.15
.
The path indicates the specific location or identifier for the resource within the server’s file system or namespace. It represents a hierarchical structure with directories and filenames. In our example, the path is /some-page
.
The query, indicated by a ?
, allows for passing parameters or additional information to the resource. It is commonly used in web addresses to provide data to the server such as search queries. In our example, the query is name=<your_name>&age=<your_age>
.
The fragment, represented by a hash symbol #
in the URI
, denotes a specific section or anchor within the resource. It is often used in web addresses to point to a specific section of a web page(s). In our example, the fragment is some-section
.
The syntax and encoding of a URI
are specific and ensure proper identification and compatibility across different systems. You must properly encode the special and reserved characters in a URI
using percent-encoding. For example, a space is encoded as %20
and ? as %3F
. In our example, we could specify the name within the query like so: name=John%20Doe&age=30
.
URI
sThere are a few types of URI
s which are differentiated by their purpose and structure such as:
URI
that specifies the web address or complete network location of a resource. URLs provide both an identifier and means to access the resource.