URI vs. URL
17th of March, 2006 (Last modified: 2nd of October, 2006) WWW ,
The distinction between URI and URL seems to be widespread and understandably so. Discussions on the internet describes different meanings, using different definitions of the acronyms and so on, so forth. In short, there is a lot of confusion. What is the correct terminology?
Reading the W3C paper on the two terms doesn't do much good as they are written for those who have a more profound understanding of the different terminologies than Average Joe.
The short version of the story is that a URL, Uniform Resource Locator, includes a network protocol (more about what that is later), a URI, Uniform Resource Identifier, doesn't have to. A URL is merely a type of a URI.
The specific explanation is as follows, the URL foo://example.com:8042/over/there?name=ferret#nose translates to scheme:authority/path?query#fragment1
The different bits and pieces of a URI
The identifier of this post is http://hvassing.com/2006/uri-vs-url/, that is its URI. In short a URI consist of a scheme name, or protocol, a colon and a path. Schemes, or protocols, can be http, https, ftp, news, mailto, file, telnet, feed and more. The reason for including the protocol is to describe the primary access mechanism of the resource. In other words, the protocol describes the network location of the resource, this resource may be locally or remotely accessible.
For this post the scheme is either http or feed depending on whether you are viewing this page through a web browser or through the RSS-feed.
After the scheme is a server name, a // followed by the host name (the human-readable name of the host machine).
Following the example with this post; http://hvassing.com or feed://hvassing.com. The bold bit is the server name.
The port where the resource is located can be included, but this is strictly optional as most resources on the web are on port 80, which is the standard http port. A port merely identifies an application or a service, meaning that one specific application will answer everything that's requested or sent to each port. What application that will answer each specific port is defined by the server administrator.
Now we're up to: http://hvassing.com:80.
Then there's the path of each document or resource, this is in essence all the files and folders that's accessible through the internet. The path can include the file extension of the document requested such as html, jpg or php which identifies the content type. In addition some pages have a query string with arguments.
Using the same example with this post, we have to amend it slightly so that http://hvassing.com/2006/uri-vs-url/ becomes http://hvassing.com/index.php?p=119. Both URI's point to the same document.
Now to the path and the query string; http://hvassing.com/index.php?p=119. The red colour is the path of the document whereas the blue colour is the query string.
In general, a URI and a URL follows the same general syntax, and thus a URL is one type of a URI.
An example of a URI that is not a URL is when one is accessing a document stored locally, such as file://. Since there is no specific network protocol specified it is a URI and not a URL. A URL will always refer to a network address, including protocol specification, host name or address and local path.
However, a final comment must be made as most people will use the informal word "link" to describe the identification of a document, and people seem to be quite forgiving when it comes to mixing up these two terms.
1Adapted from a paper by Tim Berners-Lee and Roy T. Fielding, http://www.gbiv.com/protocols/uri/rfc/rfc3986.html
Berners-Lee, Tim, Roy T. Fielding. "Uniform Resource Identifier (URI): Generic Syntax". The Internet Society. Jan. 2005. Network Working Group , 16 Mar. 2006 <http://www.gbiv.com/protocols/uri/rfc/rfc3986.html>

3 Responses to “URI vs. URL”
This is interresting for a geek like me, that actually don’t know the difference. I’m hoping that you can follow up on this post with another that goes deeper, and have more examples.
1