Uniform resource identifier (URI) and URL

From Computer Science Wiki
Web Science[1]

Characteristics of a URI[edit]

A Uniform Resource Locator (URL), is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifier (URI).[2]

  • URL's have different parts. Every URL MUST have:
    • scheme, path and host
  • URL's have different parts. Every URL MIGHT have:
    • user information
    • port
    • query
    • fragment

Please click here for an example of these different parts. In your normal day-to-day use, you probably only use a scheme and a host.

Please click here to see a list of all the available schemes. There's a LOT more than HTTP and HTTPS!!


A URL for HTTP (or HTTPS) is normally made up of three or four components:

  1. A scheme. The scheme identifies the protocol to be used to access the resource on the Internet. It can be HTTP (without SSL) or HTTPS (with SSL).
  2. A host. The host name identifies the host that holds the resource. For example, www.example.com. A server provides services in the name of the host, but hosts and servers do not have a one-to-one mapping. Refer to Host names. Host names can also be followed by a port number. Refer to Port numbers. Well-known port numbers for a service are normally omitted from the URL. Most servers use the well-known port numbers for HTTP and HTTPS , so most HTTP URLs omit the port number.
  3. A path. The path identifies the specific resource in the host that the web client wants to access. For example, /software/htp/cics/index.html.
  4. A query string. If a query string is used, it follows the path component, and provides a string of information that the resource can use for some purpose (for example, as parameters for a search or as data to be processed). The query string is usually a string of name and value pairs; for example, term=bluebird. Name and value pairs are separated from each other by an ampersand (&); for example, term=bluebird&source=browser-search.

The scheme and host components of a URL are not defined as case-sensitive, but the path and query string are case-sensitive. Typically, the whole URL is specified in lowercase.

The components of the URL are combined and delimited as follows:

scheme://host:port/path?query
  1. The scheme is followed by a colon and two forward slashes.
  2. If a port number is specified, that number follows the host name, separated by a colon.
  3. The path name begins with a single forward slash.
  4. If a query string is specified, it is preceded by a question mark.[3]

Example of a URL[edit]

The following figure displays two example URIs and their component parts. [4]

                    hierarchical part
        ┌───────────────────┴─────────────────────┐
                    authority               path
        ┌───────────────┴───────────────┐┌───┴────┐
  abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1
  └┬┘   └───────┬───────┘ └────┬────┘ └┬┘           └─────────┬─────────┘ └──┬──┘
scheme  user information     host     port                  query         fragment

  urn:example:mammal:monotreme:echidna
  └┬┘ └──────────────┬───────────────┘
scheme              path

Purpose of a URL[edit]

A URL is a string of characters used to identify a resource. The purpose of a URL is to easily retrieve network resources. URL's also make linking to resources easier.

Do you understand this?[edit]

  • identify each part of this URI:
file:///Users/billdagjana/Desktop/
  • Which one of these does a URI NOT do:
    • Enable easier access to resources
    • Provide excellent resources for linking between resources
    • Allow you to more quickly download content
    • Provide a unified syntax to access remote resources

Standards[edit]

These standards are used from the IB Computer Science Subject Guide[5]

  • Identify the characteristics of a uniform resource identifier (URI) URL.
  • Describe the purpose of a URL.

References[edit]

  1. http://www.flaticon.com/
  2. https://en.wikipedia.org/wiki/URL
  3. https://www.ibm.com/support/knowledgecenter/en/SSGMCP_5.1.0/com.ibm.cics.ts.internet.doc/topics/dfhtl_uricomp.html
  4. https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Examples
  5. IB Diploma Programme Computer science guide (first examinations 2014). Cardiff, Wales, United Kingdom: International Baccalaureate Organization. January 2012.