Monday, December 07, 2009

URI vs URL – whats the difference?

First off – URL is deprecated terminology. You are better of using URI where ever you used to use URL.

Here is why:
URI – Uniform Resource Identifier
URL – Uniform Resource Locator
*notice: its not universal as many end up calling it – it is uniform.

The URI allows for the identification of resources using the identifier. The following are all examples of URIs:
ftp://ftp.sample.com/samplefiles/readme.txt
http://www.sample.com/samplefiles/readme.html
http://www.sample.com/samplefiles/readme.txt
https://www.sample.com/samplefiles/readme.html
mailto:jane.doe@sample.com

Even the scheme “tel:+1-800-800-8000” is considered a URI. In the early days (!), a URI was either a URN or a URL (i.e, the URI either referred to the the name without the location or the location of a resource). The term URL is now considered to be a URI that identifies a resource via its access mechanism (http, ftp, etc). Here the http, ftp, etc in the URL address are known as URI schemes (and define the syntax that is legal in the URI). So just remember, basically the URL is a subset of URI. (i.e., all URLs are URIs).

So, instead of worrying about the difference, just use the TLA URI instead of URL from now on.

reference:
Uniform Resource Identifier: Generic Syntax: http://labs.apache.org/webarch/uri/rfc/rfc3986.html
Uniform Resource Identifiers (URIs), URLs, and Uniform Resource Names(URNs): Clarifications and Recommendations: http://www.ietf.org/rfc/rfc3305.txt

No comments: