Hacker News new | past | comments | ask | show | jobs | submit login
Difference Between URL and URI (stackoverflow.com)
97 points by carlsednaoui on March 7, 2012 | hide | past | favorite | 9 comments



My favourite example to give for this distinction is 'news' vs 'nntp'.

An 'nntp' URL specifies a specific message in a specific group on a specific server, hence it always has an authority part. It's also indicating to use the NNTP protocol to retrieve the message.

A 'news' URI, on the other hand, identifies a specific message by its message ID, and leaves it to the user agent to choose a protocol and server.

(The distinction isn't quite that clear cut, as 'news' URIs can specify a server, making them more like URLs, but I think it conveys the difference.)


I hope one of the top two Stackoverflow answers steals this example and appends it. It is better than any of the examples in the thread.


On a somewhat related note:

http://www.rfc-editor.org/rfc/rfc3986.txt

From section 1.1.3:

   An individual scheme does not have to be classified as being just one
   of "name" or "locator".  Instances of URIs from any given scheme may
   have the characteristics of names or locators or both, often
   depending on the persistence and care in the assignment of
   identifiers by the naming authority, rather than on any quality of
   the scheme.  Future specifications and related documentation should
   use the general term "URI" rather than the more restrictive terms
   "URL" and "URN" [RFC3305].


That's a very related note!

The classic hierarchy ("URLs and URNs are distinct subsets of URIs") wasn't as neat and useful as originally thought, so "it's just URIs now, with their own scheme-specific qualities" is the modern thinking, as reflected by this passage from RFC3986.

The modern answer to "What's the difference between a URI and URL?" is thus very nearly 'Mu.'


I've met Jon Skeet and he sincerely is a really smashing chap. The cult of Skeet on SO is getting a tad much.

(I find sycophantic behaviour a terrible trait)


For completeness, IRIs should be mentioned as well.


Which are?


Internationalized URIs


Multiple times I've called a URL a "URL" only to have some linked data enthusiast "correct" you by saying "you mean URI".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: