URI (Uniform Resource Identifier)
- Introduction to URIs.
- Fragment identifiers.
- Relative URIs.
1. Introduction to URIs.
The World Wide Web (Web) is a network of information
resources. Every resource available on the Web -- HTML document,
image, video clip, program, etc. -- has an address that may be encoded
by a Universal Resource Identifier, or "URI".
URIs typically consist of three pieces:
Consider the following URI:
- The naming scheme of the mechanism used to
access the resource (e.g. http: ftp: mailto:).
- The name of the machine hosting the resource.
- The name of the resource itself, given as a path.
This URI may be read as follows: There is a document index.htm
available via the HTTP protocol, residing on the machine
www.pmg3.com, accessible via the path /varna/school/.
Other schemes you may see in HTML documents include "mailto:" for email
(e.g. mailto:firstname.lastname@example.org) and "ftp:" for FTP.
2. Fragment identifiers.
Some URIs refer to a location within a resource. This kind of URI ends
with # followed by an anchor identifier (called the
For instance, here is a URI pointing
to an anchor named pos2 in the file index.htm:
3. Relative URIs.
A relative URI doesn't contain any naming scheme
information. Its path generally refers to a resource on the
same machine as the current document. Relative URIs may contain
relative path components (e.g., ".." means one level up in the
hierarchy defined by the path), and may contain fragment identifiers.
For example, if the following directory structure resides on the
| | city.htm
| | boat.htm
and the document index.htm contains links pointing to files
mary.jpg, city.htm, boat.htm, present.htm,
instead of full URIs:
the following relative URIs, may be used:
Relative URIs are resolved to full URIs using a base URI
(the URI of the current document).
For easy transition of files to another machine the
use of relative URIs is recommended.
Servers are UNIX based machines, so URIs are
For example, the following URIs are all different:
Note: Most readers may be familiar with
the term "URL" and not the term "URI". URLs form a subset of the
more general URI naming scheme.