the difference between a URL and a URI: https://danielmiessler.com/study/url-uri/(Wiki explained)
? There are many classic high-tech debates, and the question of what formally calls Web addresses is one of the most nuanced. This usually manifests itself in the way that someone asks for a "URL" to be put into his or her browser, and someone pays the price,
In fact, this is called URI , not URLs ...
The response to this correction can be to quietly think that this person needs to come out more, by shrugging his shoulders without agreeing to remove the safety clasp on the katana. This page is intended as a simple one-page summary for viewing the subtleties of this debate.
Uri,url,urn
as shown, there are three different components. When discussing these issues, it is usually better to go to the source, so here is an excerpt from Tim Berners-lee and others. people. in RFC 3986: Uniform Resource Identifier (URI): Common syntax:
A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource.
URIs can be further categorized as locators, names, or both. the term Uniform Resource Locator (URL) refers to a subset of URIs that, in addition to identifying resources, provides a means of locating resources by describing their primary access mechanisms, such as their network "location".
wikipedia This is captured by the following simplification :
you can classify URIs as locators (URLs), or classify names (urns), or classify them at the same time. a Uniform Resource name (URN) is a function similar to a person name, and a Uniform Resource Locator (URL) resembles the street address of the man. In other words: The urn defines the identity of the project, and the URL provides a way to find the item's identity.
So we got something from these descriptions:
- First (we also see in the diagram) the URL is a URI . Therefore, if someone tells you that the URL is not a URI, then he is wrong. However, this does not mean that all URIs are URLs. All the butterflies fly, but not the flies are butterflies.
- The part that makes the URI a URL includes "access mechanism" or "network location", for example
http://
or ftp://
.
- urns are part of the "Global only" in recognition; This is a unique name.
So let's take a look at some examples of URIs-again from the RfC:
ftp://ftp.is.co.za/rfc/rfc1808.txt
(Because the protocol is also a URL)
http://www.ietf.org/rfc/rfc2396.txt
(Because the protocol is also a URL)
ldap://[2001:db8::7]/c=GB?objectClass?one
(Because the protocol is also a URL)
mailto:[email protected]
(Because the protocol is also a URL)
news:comp.infosystems.www.servers.unix
(Because the protocol is also a URL)
tel:+1-816-555-1212
telnet://192.0.2.16:80/
(Because the protocol is also a URL)
urn:oasis:names:specification:docbook:dtd:xml:4.1.2
These are URIs, some of which are URLs. what are URLs? The people who tell you how to get to them. Similarly, the name and address analogy is good.
which is more accurate?
So this brings us a lot of readers ' questions:
which is more appropriate when referring to URLs?
Based on the more than 10 articles and RFCs I read in this article, I would say it depends on a very simple matter: Are you complete or just one.
Why?
Well, because we often use URIs in forms that technically do not conform to URLs. For example, you may be told that the files you need are located files.hp.com
. This is a URI, not a URL-the system may respond well to many protocols on many ports.
If you go, http://files.hp.com
What you can imagine is totally different ftp://files.hp.com
from what you're going to get. . and this kind of thing will only become more and more common. think about all the different services that live on a variety of Google domains.
Therefore, if you use the URI , then technically it is always correct if you use URL , it may not be.
But if you are definitely dealing with the actual full URL, then the "url" is the most accurate, because it is the most specific. Humans are technically African apes, dogs are mammals, but we call them humans and dogs, respectively. If you're from San Francisco and you meet someone from Sydney in Boston, you won't say you're from Earth or from the United States. You would say California, or better--San Francisco.
as a result, until some content has changed, When you refer to a resource only by name or other fragment , best to use URI . when you provide both the name of the resource and the method that accesses it (such as the full URL), it is best to call it a URL.
Overview
- URI is identifiers that can represent a name, location, or both.
- All urns and URLs are URIs, but the opposite is true.
- The part that creates the URL is a combination of name and access methods, such as
https://
, or mailto:
.
- All of these bits are URIs, so it's technically accurate, but if you're talking about a full URL and a URI (all URLs are), it's better to call it "url" because it's more specific.
notes and References
- RFC 2396.
- Wikipedia | URI .
- explain different from the damnhandy.com .
- Another interesting question is that Google Chrome now intentionally removes the protocol from the display in the browser-which in effect translates the URL into a URI.
The difference between a URI and a URL