The URI stands for Uniform Resource Identifier and it is used to define or "explain" the protocol, the location and the name of a file that is being looked for by a browser. In other words an URI is the line we see in a browsers address bar.

Although, due some historical confusions, URI gets replaced with URL a lot, more accurate name for the address is URI. That is because URI is a superset of URL, or every URL is an URI but the other way around.

Technically a URI can be a URL (Uniform Resource Locator) or a URN (Uniform Resource Name). Any URI that does not use URN for addressing is a URL.

A URN is still not very known to common Internet users because it doesn't get used a lot. Essentially it is like a person's name and gets often compared to the ISBN system.

A URL, using a similar comparison, would be something like a street address.

The URN syntax is formed like this:

URN:="urn:"NID":"NSS

Where:

  • NID is namespace identifier
  • NSS is namespace specific string (can be omitted)

The URL syntax is formed like this:

scheme://host.domain:port/path/filename

Where:

  • scheme; defines the type of protocol or system used, most common being the http
  • host; defines the domain host (the default host for http is www)
  • domain; defines the Internet domain name, like brenkoweb.com (or IP address if entered properly)
  • port; defines the port number at the host (the default port number for http is 80 and it is usually omitted)
  • path; defines a path at the server (if omitted, the document must be stored at the root directory of the web site)
  • filename; defines the name of a document/resource (if omitted then in the domain/path there must be a file called index or default (extension must supported by the browser (i.e. .html, .php, .asp)))

Common URL schemes are:

  • http; HyperText Transfer Protocol ? regular http, not encrypted
  • https; Secure HyperText Transfer Protocol ? encrypted http
  • ftp; File Transfer Protocol - files handling on Internet
  • file; File path on your local computer
  • mailto; E-mail address
  • news; Usenet newsgroup

A URL (or broader URI) can be expressed also with a fragment identifier or with a relative URL path.

A fragment identifier refers to a local resource. Such URL ends with # followed by anchor identifier.

A relative URL refers to an address that is suppose to be inside the current document and therefore there is no need for fully expressed naming scheme but rather only the filename and if necessary its relative path.

Example for URN:

urn:isbn: 0-312-02282-4 (The Silence of the Lambs, 1988)

Example for URL with the absolute path:

www.brenkoweb.com/tutorials/html/html-basics/html_intro.php

Example for URL with the relative path:

../../css/css-advanced/characters-encoding-in-css.php

Example for URL with the fragment identifier:

../tutorials/html/html-advanced/uris.php#top

 

›› go to examples ››