By undone


2011-09-02 13:04:48 8 Comments

I have read these pages:

I know basic about URL, URN, and URI; but little on their differences. The thing I can't understand is in a page like: http://www.bernzilla.com/item.php?id=100 which part is URL, URN and URI!
URI is whole part but URL and URN??

Picture from wikipedia

Edit:
from w3c.org:

An URL is a type of URI that identifies a resource via a representation of its primary access mechanism (e.g., its network "location"), rather than by some other attributes it may have.

from www.damnhandy.com:

It is now considered incorrect to use URL when describing applications.

Now is id an attribute? What about application part? Is PHP an application?

3 comments

@Stephen Ostermiller 2015-03-04 21:48:27

URI/URL Venn Diagram

URL -- Uniform Resource Locator

Contains information about how to fetch a resource from its location. For example:

  • http://example.com/mypage.html
  • ftp://example.com/download.zip
  • mailto:[email protected]
  • file:///home/user/file.txt
  • tel:1-888-555-5555
  • http://example.com/resource?foo=bar#fragment
  • /other/link.html (A relative URL, only useful in the context of another URL)

URLs always start with a protocol (http) and usually contain information such as the network host name (example.com) and often a document path (/foo/mypage.html). URLs may have query parameters and fragment identifiers.

URN -- Uniform Resource Name

Identifies a resource by a unique and persistent name. It usually starts with the prefix urn: For example:

  • urn:isbn:0451450523 to identify a book by its ISBN number.
  • urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66 a globally unique identifier
  • urn:publishing:book - An XML namespace that identifies the document as a type of book.

URNs can identify ideas and concepts. They are not restricted to identifying documents. When a URN does represent a document, it can be translated into a URL by a "resolver". The document can then be downloaded from the URL.

URI -- Uniform Resource Identifier

URIs encompass URLs, URNs, and other ways to identify a resource.

An example of a URI that is neither a URL nor a URN would be a data URI such as data:,Hello%20World. It is not a URL nor a URN because the URI contains the data. It neither names it, nor tells you how to locate it over the network.

There are also uniform resource citations (URCs) that point to meta data about a document rather than to the document itself. An example of a URC would be an identifier for viewing the source code of a web page: view-source:http://example.com/. A URC is another type of URI that is neither URL nor URN.

Frequently Asked Questions

I've heard that I shouldn't say URL anymore, why?

The W3 spec for HTML says that the href of an anchor tag can contain a URI, not just a URL. You should be able to put in a URN such as <a href="urn:isbn:0451450523">. Your browser would then resolve that URN to a URL and download the book for you.

Do any browsers actually know how to fetch documents by URN?

Not that I know of, but modern web browser do implement the data URI scheme.

Does the difference between URL and URI have anything to do with whether it is relative or absolute?

No. Both relative and absolute URLs are URLs (and URIs.)

Does the difference between URL and URI have anything to do with whether it has query parameters?

No. Both URLs with and without query parameters are URLs (and URIs.)

Does the difference between URL and URI have anything to do with whether it has a fragment identifier?

No. Both URLs with and without fragment identifiers are URLs (and URIs.)

But doesn't the W3C now say that URLs and URIs are the same thing?

Yes. The W3C realized that there is a ton of confusion about this. They issued a URI clarification document that says that it is now OK to use the terms URL and URI interchangeably (to mean URI). It is no longer useful to strictly segment URIs into different types such as URL, URN, and URC.

Can a URI be both a URL and a URN?

The definition of URN is now looser than what I stated above. The latest RFC on URIs says that any URI can now be a URN (regardless of whether it starts with urn:) as long as it has "the properties of a name." That is: It is globally unique and persistent even when the resource ceases to exist or becomes unavailable. An example: The URIs used in HTML doctypes such as http://www.w3.org/TR/html4/strict.dtd. That URI would continue to name the HTML4 transitional doctype even if the page on the w3.org website were deleted.

@mike 2016-11-15 05:36:28

What confuses me about the W3C clarification and the URL/URI distinction is that actually a lot of web server documents describe the URL as the whole request string, and the URI as "the part following the protocol". It even references that part by the variable name $uri. For example: nginx.com/blog/creating-nginx-rewrite-rules This isn't strictly "correct" by W3C definitions it seems? But it's the most useful I think.

@Stephen Ostermiller 2016-11-15 10:00:22

URIs were widely misunderstood. Many people thought that a URI was a portion of the URL like a relative URL, or following the protocol. This was never correct, but those ideas made it into server documentation or into programming APIs fairly often.

@Kris 2011-09-02 14:03:09

It is not the case that the URL you mention is composed of both a URL and URN part.

http://www.bernzilla.com/item.php?id=100 is both a URL and a URI.

Basically URIs are a superset of URLs and of URNs. There is some overlap between URLs and URNs as well.

A URI identifies a resource either by location, or a name, or both.

So any URL is a URI, any URN is a URI, but not every URI is a URL.

@paulmorriss 2011-09-02 13:12:19

I think those articles explain quite well. To answer your question - all of this is a URL:

http://www.bernzilla.com/item.php?id=100

Each bit of it - http: www.bernzilla.com and so on has it's own name:

  • http: is the scheme
  • www is the sub-domain
  • bernzilla.com is the domain
  • com is the top level domain or TLD
  • (there could be a folder or path there, e.g. /dir/item.php but there isn't)
  • item.php is the page or filename which has an extension php
  • id=100 is the query string

I can see given that diagram from wikipedia why you're asking though. That diagram is saying there are two types of URI - URLs and URNs and the fuzzy bit in the middle is when something can be both.

@undone 2011-09-02 13:35:58

Thanks for answer. I edited my question. can you take look again?

@paulmorriss 2011-09-02 13:53:27

I don't understand that quote about describing applications and I can't see a comment where someone points that out. I'll update my answer to describe the separate parts.

@DisgruntledGoat 2011-09-07 14:37:09

@paul don't you mean URI in the first line? id=100 isn't a location, it's an indicator.

@paulmorriss 2011-09-07 14:43:23

I think I meant URL. With some sites if you change the id you get different "pages" in normal-speak. Reading the definition of resource on wikipedia I think a page is an example of a resource.

Related Questions

Sponsored Content

2 Answered Questions

2 Answered Questions

[SOLVED] In a URI, what does the suffix ".do" stand for?

  • 2011-03-02 16:06:37
  • Chris Adragna
  • 10103 View
  • 7 Score
  • 2 Answer
  • Tags:   url-rewriting url

2 Answered Questions

[SOLVED] Is there any SEO difference between /blog and /blogs?

  • 2016-07-10 23:13:44
  • Phil Andrews
  • 54 View
  • 0 Score
  • 2 Answer
  • Tags:   seo url

4 Answered Questions

[SOLVED] What is good URI design?

4 Answered Questions

4 Answered Questions

1 Answered Questions

[SOLVED] Most invariant URI to refer to a HTML5 element from w3.org?

  • 2014-06-28 16:27:25
  • HostileFork says dont trust SE
  • 75 View
  • 2 Score
  • 1 Answer
  • Tags:   url html5 xml

2 Answered Questions

[SOLVED] What is the difference between URLS with hashtags and hashtags with exclamation marks

  • 2011-08-22 17:44:23
  • faressoft
  • 1170 View
  • 2 Score
  • 2 Answer
  • Tags:   seo url

Sponsored Content