What is the difference between a URI, a URL and a URN?

Sean McMains

People talk about URLs, URIs, and URNs as if they're different things, but they look the same to the naked eye.

What are the distinguishable differences between them?

Jon Skeet

From RFC 3986:

A URI can be further classified as a locator, a name, or both. The term "Uniform Resource Locator" (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network "location"). The term "Uniform Resource Name" (URN) has been used historically to refer to both URIs under the "urn" scheme [RFC2141], which are required to remain globally unique and persistent even when the resource ceases to exist or becomes unavailable, and to any other URI with the properties of a name.

So all URLs are URIs (actually not quite - see below), and all URNs are URIs - but URNs and URLs are different, so you can't say that all URIs are URLs.

EDIT: I had previously thought that all URLs are valid URIs, but as per comments:

Not "all URLs are URIs". It depends on the interpretation of the RFC. For example in Java the URI parser does not like [ or ] and that's because the spec says "should not" and not "shall not".

So that muddies the waters further, unfortunately.

If you haven't already read Roger Pate's answer, I'd advise doing so as well.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

What's the difference between a Resource, URI, URL, Path and File in Java?

From Dev

URI/URL and String what is the difference?

From Dev

What is the difference between a URL and a LINK?

From Dev

What is the difference between URLRequest and URL?

From Dev

What's different between URI, request-URI and URL?

From Dev

What is the reason for the difference between these two urlencodings of url

From Dev

What is the difference between url vs urlRoot

From Dev

What is the difference between these url mapping patterns?

From Dev

What is the speed difference between downloading with URL and Sockets?

From Dev

What is the difference between url vs urlRoot

From Dev

What is difference between Port Knocking and URL Knocking?

From Dev

What is the difference between $_SERVER['REQUEST_URI'] and "$_SERVER['REQUEST_URI']" (note double quotes)?

From Dev

Difference between `URI` and `URI.parse`

From Dev

generate an urn/iri/uri dynamically

From Dev

What's the difference between href and path in Url.parse() object?

From Dev

What is the difference between 'url' and 'path' in symfony2.3

From Dev

What is the difference between 'url' and 'path' in symfony2.3

From Dev

What's the difference between get_stylesheet_directory_uri() and get_template_directory_uri() when enqueuing scripts in wordpress

From Dev

What's the difference between File.toURI vs Uri.fromFile in Android

From Dev

What's the difference between CGI.unescape and URI.decode_www_form_component?

From Dev

What's the difference between "as?", "as!", and "as"?

From Dev

What is the difference in operation between . and ^ and ^(.*)$?

From Dev

What is the difference between .// and //* in XPath?

From Dev

What is the difference between = and => for a variable?

From Dev

What is difference between "?" and "!" in Swift?

From Java

What is the difference between `.` and `#` in the JavaDoc?

From Dev

CoffeeScript, What is the difference between => and ->

From Java

What is the difference between * and *|* in CSS?

From Dev

What is the difference between $* and $@

Related Related

  1. 1

    What's the difference between a Resource, URI, URL, Path and File in Java?

  2. 2

    URI/URL and String what is the difference?

  3. 3

    What is the difference between a URL and a LINK?

  4. 4

    What is the difference between URLRequest and URL?

  5. 5

    What's different between URI, request-URI and URL?

  6. 6

    What is the reason for the difference between these two urlencodings of url

  7. 7

    What is the difference between url vs urlRoot

  8. 8

    What is the difference between these url mapping patterns?

  9. 9

    What is the speed difference between downloading with URL and Sockets?

  10. 10

    What is the difference between url vs urlRoot

  11. 11

    What is difference between Port Knocking and URL Knocking?

  12. 12

    What is the difference between $_SERVER['REQUEST_URI'] and "$_SERVER['REQUEST_URI']" (note double quotes)?

  13. 13

    Difference between `URI` and `URI.parse`

  14. 14

    generate an urn/iri/uri dynamically

  15. 15

    What's the difference between href and path in Url.parse() object?

  16. 16

    What is the difference between 'url' and 'path' in symfony2.3

  17. 17

    What is the difference between 'url' and 'path' in symfony2.3

  18. 18

    What's the difference between get_stylesheet_directory_uri() and get_template_directory_uri() when enqueuing scripts in wordpress

  19. 19

    What's the difference between File.toURI vs Uri.fromFile in Android

  20. 20

    What's the difference between CGI.unescape and URI.decode_www_form_component?

  21. 21

    What's the difference between "as?", "as!", and "as"?

  22. 22

    What is the difference in operation between . and ^ and ^(.*)$?

  23. 23

    What is the difference between .// and //* in XPath?

  24. 24

    What is the difference between = and => for a variable?

  25. 25

    What is difference between "?" and "!" in Swift?

  26. 26

    What is the difference between `.` and `#` in the JavaDoc?

  27. 27

    CoffeeScript, What is the difference between => and ->

  28. 28

    What is the difference between * and *|* in CSS?

  29. 29

    What is the difference between $* and $@

HotTag

Archive