People talk about URLs, URIs and URNs as if they're different things, but they look the same to the naked eye.
人们谈论url, uri和urn,就好像它们是不同的东西,但是它们看起来和肉眼是一样的。
What are the distinguishable differences between them?
他们之间有什么区别?
33 个解决方案
#1
1458
From RFC 3986:
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.
URI可以进一步划分为定位器、名称或两者。术语“统一资源定位器”(URL)指的是uri的子集,除了标识资源外,还提供了通过描述其主要访问机制(例如,其网络“位置”)来定位资源的方法。术语“统一资源名称”(URN)在历史上一直被用于指代“URN”计划(RFC2141)下的URI,它被要求在资源停止存在或不可用的情况下保持全局惟一和持久,以及具有名称属性的任何其他URI。
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.
所以所有的url都是uri(实际上不是很清楚),所有的urn都是uri——但是urn和url是不同的,所以你不能说所有uri都是url。
EDIT: I had previously thought that all URLs are valid URIs, but as per comments:
编辑:我以前认为所有的url都是有效的uri,但是根据评论:
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".不是“所有url都是uri”。这取决于对RFC的解释。例如,在Java中,URI解析器不喜欢(或),这是因为规范说“不应该”而不是“不应该”。
So that muddies the waters further, unfortunately.
因此,不幸的是,这种情况进一步恶化了海水。
If you haven't already read Roger Pate's answer, I'd advise doing so as well.
如果你还没有读过Roger Pate的答案,我建议你也这样做。
#2
3461
URIs identify and URLs locate; however, locators are also identifiers, so every URL is also a URI, but there are URIs which are not URLs.
uri标识和url定位;但是,定位器也是标识符,所以每个URL也是一个URI,但是URI不是URL。
Examples
- Roger Pate
- 罗杰脑袋
This is my name, which is an identifier. It is like a URI, but cannot be a URL, as it tells you nothing about my location or how to contact me. In this case it also happens to identify at least 5 other people in the USA alone.
这是我的名字,它是一个标识符。它就像一个URI,但不能是URL,因为它没有告诉您任何关于我的位置或如何联系我的信息。在这种情况下,仅在美国就会发现至少5个人。
- 4914 West Bay Street, Nassau, Bahamas
- 巴哈马拿骚西湾街4914号
This is a locator, which is an identifier for that physical location. It is like both a URL and URI (since all URLs are URIs), and also identifies me indirectly as "resident of..". In this case it uniquely identifies me, but that would change if I get a roommate.
这是一个定位器,它是物理位置的标识符。它就像一个URL和URI(因为所有URL都是URI),并且也间接地将我标识为“..”的居民。在这种情况下,它唯一地标识我,但如果我有一个室友,那就会改变。
I say "like" because these examples do not follow the required syntax.
我说“like”,因为这些示例不遵循所需的语法。
Popular confusion
From Wikipedia:
从*:
In computing, a Uniform Resource Locator (URL) is a subset of the Uniform Resource Identifier (URI) that specifies where an identified resource is available and the mechanism for retrieving it. In popular usage and in many technical documents and verbal discussions it is often incorrectly used as a synonym for URI, ... [emphasis mine]
在计算中,统一资源定位符(URL)是统一资源标识符(Uniform Resource Identifier, URI)的子集,该标识符指定了可用的标识资源的位置,以及检索该资源的机制。在流行的用法和许多技术文档和口头讨论中,它经常被错误地用作URI的同义词……(强调我的)
Because of this common confusion, many products and documentation incorrectly use one term instead of the other, assign their own distinction, or use them synonymously.
由于这种常见的混淆,许多产品和文档错误地使用一个术语而不是另一个术语,分配它们自己的区别,或者使用它们同义。
URNs
My name, Roger Pate, could be like a URN (Uniform Resource Name), except those are much more regulated and intended to be unique across both space and time.
我的名字,Roger Pate,可能像一个URN(统一的资源名),除了那些更规范,并且在空间和时间上都是独特的。
Because I currently share this name with other people, it's not globally unique and would not be appropriate as a URN. However, even if no other family used this name, I'm named after my paternal grandfather, so it still wouldn't be unique across time. And even if that wasn't the case, the possibility of naming my descendants after me make this unsuitable as a URN.
因为我现在和其他人分享这个名字,它不是全球唯一的,也不适合作为一个URN。然而,即使没有其他家庭使用这个名字,我还是以我祖父的名字命名,所以它仍然不会是唯一的跨越时间。即使事实并非如此,我的后代也有可能在我之后命名为URN。
URNs are different from URLs in this rigid uniqueness constraint, even though they both share the syntax of URIs.
在这种严格的唯一性约束中,urn不同于url,尽管它们都共享uri的语法。
#3
442
URI -- Uniform Resource Identifier
URIs are a standard for identifying documents using a short string of numbers, letters, and symbols. They are defined by RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax. URLs, URNs, and URCs are all types of URI.
uri是一种使用数字、字母和符号来标识文档的标准。它们由RFC 3986 -统一资源标识符(URI)定义:通用语法。url、urn和URCs都是URI的类型。
URL -- Uniform Resource Locator
Contains information about how to fetch a resource from its location. For example:
包含有关如何从其位置获取资源的信息。例如:
http://example.com/mypage.html
- http://example.com/mypage.html
ftp://example.com/download.zip
- ftp://example.com/download.zip
mailto:user@example.com
- mailto:user@example.com
file:///home/user/file.txt
- 文件:/ / / home / user / file.txt
tel:1-888-555-5555
- 电话号码:1-888-555-5555
http://example.com/resource?foo=bar#fragment
- http://example.com/resource?foo=bar片段
-
/other/link.html
(A relative URL, only useful in the context of another URL) - /其他/链接。html(相对URL,只在另一个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.
url总是以协议(http)开头,通常包含诸如网络主机名(example.com)和文档路径(/foo/mypage.html)等信息。url可能有查询参数和片段标识符。
URN -- Uniform Resource Name
Identifies a resource by a unique and persistent name, but doesn't necessarily tell you how to locate it on the internet. It usually starts with the prefix urn:
For example:
通过一个独特且持久的名称标识一个资源,但并不一定告诉您如何在internet上定位它。通常从前缀urn开始:例如:
-
urn:isbn:0451450523
to identify a book by its ISBN number. - urn:isbn:0451450523通过isbn号来识别一本书。
-
urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66
a globally unique identifier - urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66全球唯一标识符。
-
urn:publishing:book
- An XML namespace that identifies the document as a type of book. - 发布:book -一个XML名称空间,它将文档标识为一种类型的图书。
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.
urn可以识别想法和概念。它们不限于识别文件。当一个URN表示一个文档时,它可以被一个“解析器”翻译成一个URL。然后可以从URL下载该文档。
URC -- Uniform Resource Citation
Points to meta data about a document rather than to the document itself. An example of a URC is one that points to the HTML source code of a page like: view-source:http://example.com/
指向文档的元数据,而不是文档本身。URC的一个例子是指向一个页面的HTML源代码,比如:http://example.com/。
Data URI
Rather than locating it on the internet, or naming it, data can be placed directly into a URI. An example would be data:,Hello%20World
.
数据可以直接放在URI中,而不是在internet上定位或命名它。一个例子就是数据:Hello%20世界。
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.
HTML的W3规范说,锚标记的href可以包含URI,而不只是URL。您应该能够放入一个URN,例如。你的浏览器会将URN解析为一个URL并为你下载这本书。
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.
我并不知道,但现代web浏览器确实实现了数据URI方案。
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.)
不。相对和绝对url都是url(和uri)。
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.)
不。带有和没有查询参数的url都是url(和uri)。
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.)
不。带有和没有片段标识符的url都是url(和uri)。
Does the difference between URL and URI have anything to do with what characters are permitted?
No. URLs are defined to be a strict subset of URIs. If a parser allows a character in a URL but not in a URI, there is a bug in the parser. The specs go into great detail about which characters are allowed in which parts of URLs and URIs. Some characters may be allowed only in some parts of the URL, but characters alone are not a difference between URLs and URIs.
不。url被定义为uri的一个严格子集。如果解析器允许URL中的字符而不是URI,则解析器中有一个错误。该规范详细介绍了哪些字符可以在哪些url和uri中使用。有些字符只允许在URL的某些部分,但是字符本身并不是URL和uri之间的区别。
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.
是的。W3C意识到对此有很多困惑。他们发布了一个URI澄清文档,该文档表示现在可以将URL和URI互换(表示URI)。将uri划分为URL、URN和URC等不同类型的uri不再有用。
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.
URN的定义现在比我上面说的要宽松。URIs的最新RFC表示,任何URI现在都可以是URN(无论它是从URN开始的),只要它具有“名称的属性”。也就是说,即使资源停止存在或不可用,它仍然是全局惟一和持久的。示例:在HTML doctype中使用的uri,如http://www.w3.org/TR/html4/strict.dtd。即使w3.org网站上的页面被删除,这个URI仍然会继续命名HTML4过渡型doctype。
#4
227
In summary: a URI identifies, a URL identifies and locates.
总结:一个URI标识,一个URL标识和定位。
Consider a specific edition of Shakespeare's play Romeo and Juliet, of which you have a digital copy on your home network.
考虑一个特定版本的莎士比亚戏剧《罗密欧与朱丽叶》,其中你的家庭网络上有一个数字拷贝。
You could identify the text as urn:isbn:0-486-27557-4
.
That would be a URI, but more specifically a URN* because it names the text.
您可以将文本定义为urn:isbn:0-486-27557-4。这将是一个URI,但更具体地说是一个URN*,因为它命名了文本。
You could also identify the text as file://hostname/sharename/RomeoAndJuliet.pdf
.
That would also be a URI, but more specifically a URL because it locates the text.
您还可以将文本标识为文件://hostname/sharename/RomeoAndJuliet.pdf。这也将是一个URI,但更具体地说是一个URL,因为它定位了文本。
*Uniform Resource Name
*统一资源名称
(Note that my example is adapted from Wikipedia)
(请注意,我的例子是根据*改编的)
#5
123
These are some very well-written but long-winded answers. Here is the difference as far as CodeIgniter is concerned:
这些都是一些写得很好的但冗长的答案。这里是关于CodeIgniter的不同之处:
URL - http://example.com/some/page.html
URL http://example.com/some/page.html
URI - /some/page.html
URI - /一些/ page.html
Put simply, URL is the full way to indentify any resource anywhere and can have different protocols like FTP, HTTP, SCP, etc.
简单地说,URL是识别任何地方的任何资源的完整方法,并且可以有不同的协议,如FTP、HTTP、SCP等。
URI is a resource on the current domain, so it needs less information to be found.
URI是当前域中的一个资源,因此它需要找到的信息更少。
In every instance that CodeIgniter uses the word URL or URI this is the difference they are talking about, though in the grand-scheme of the web, it is not 100% correct.
在CodeIgniter使用URL或URI的每个实例中,这是他们所讨论的差异,尽管在web的grand-scheme中,它不是100%正确的。
#6
81
URI -> Uniform Resource Identifier
URI ->统一资源标识符。
- URI is a text which is used to identify any resource or name on Internet.
- URI是用于在Internet上标识任何资源或名称的文本。
- URI has two specializations in the form of URL (Uniform Resource Locator) and URN (Uniform Resource Name)
- URI以URL(统一资源定位符)和URN(统一资源名)的形式有两个专门化
- This two specifications are used to identify resource and name.
- 这两个规范用于标识资源和名称。
URL -> Uniform Resource Locator
URL ->统一资源定位器。
- It is a subset of URI
- 它是URI的子集。
- URL includes location as well as the protocol to retrieve the resource (For example :HTTP Protocol is used to retrive resource)
- URL包括检索资源的位置和协议(例如:HTTP协议用于检索资源)
URN -> Uniform Resource Name
URN ->统一资源名。
- It is also a subset of URI
- 它也是URI的子集。
- URN is completely different than URL as it doesn't include any protocol.
- URN与URL完全不同,因为它不包含任何协议。
Diference between URI,URL and URN
URI、URL和URN之间的差异。
1) Every URL and URN is URI because URI is the superset of both URL and URN.
1)每个URL和URN都是URI,因为URI是URL和URN的超集。
2) URL includes protocol e.g. http://, ftp:// along with location to identify resource e.g. http://www.blogspot.com/abc.html.
2)URL包括协议,例如http://, ftp://和位置识别资源,例如http://www.blogspot.com/abc.html。
3) URN are the unambiguous way to identify a resource. ISBN numbers are best examples of URN
3)URN是确定资源的明确方法。ISBN数字是URN的最好例子。
#7
62
A small addition to the answers already posted, here's a Venn's diagram to sum up the theory (from Prateek Joshi's beautiful explanation):
在已经发布的答案中,有一个小的补充,下面是一个维恩的图表来总结这个理论(从Prateek Joshi的美丽解释):
And an example (also from Prateek's website):
还有一个例子(来自Prateek网站):
#8
51
This is one of the most confusing and possibly irrelevant topics I've encountered as a web professional.
这是我作为一个网络专家遇到的最令人困惑和可能不相关的话题之一。
As I understand it, a URI is a description of something, following an accepted format, that can define both or either the unique name (identification) of something and its location.
正如我所理解的,URI是对某物的描述,它遵循一种被接受的格式,它可以定义某物的唯一名称(标识)和它的位置。
There are two basic subsets - URLs, which define location (especially to a browser trying to look up a webpage) and URNs, which define the unique name of something.
有两个基本的子集——url,它定义了位置(特别是浏览器试图查找网页)和urn,它定义了某个东西的唯一名称。
I tend to think of URNs as being similar to GUIDs. They are simply a standardized methodology for providing unique names for things. As in the namespace declarative that uses a company's name - it's not like there is a resource sitting on a server somewhere to correspond to that line of text - it simply uniquely identifies something.
我倾向于认为urn类似于GUIDs。它们只是为事物提供唯一名称的标准化方法。就像使用公司名称的名称空间声明一样——它不像在服务器上有一种资源可以对应于这一行文本——它只是唯一地标识某些东西。
I also tend to completely avoid the term URI and discuss things only in terms of URL or URN as appropriate, because it causes so much confusion. The question we should really try answering for people isn't so much the semantics, but how to identify when encountering the terms whether or not there is any practical difference in them that will change the approach to a programming situation. For example, if someone corrects me in conversation and says, "oh, that's not a URL it's a URI" I know they're full of it. If someone says "we're using a URN to define the resource" I'm more likely to understand we are only naming it uniquely, not locating it on a server.
我也倾向于完全避免使用术语URI,并且只在URL或URN上讨论事情,因为它会引起如此多的混乱。我们真正应该尝试回答的问题不是语义,而是如何识别遇到的术语是否有实际的差异,这将改变编程环境的方法。例如,如果有人在对话中纠正我说,“哦,那不是URL,它是一个URI”,我知道他们都是这样。如果有人说“我们正在使用URN来定义资源”,我更可能理解我们只是将其命名为惟一的,而不是将其定位在服务器上。
If I'm way off base - please let me know!
如果我离开基地,请告诉我!
#9
40
URI => http://en.wikipedia.org/wiki/Uniform_Resource_Identifier
URI http://en.wikipedia.org/wiki/Uniform_Resource_Identifier = >
URL's are a subset of URI's (which also contain URNs).
URL是URI(也包含urn)的子集。
Basically, a URI is a general identifier, where a URL specifies a location and a URN specifies a name.
基本上,URI是一个通用标识符,URL指定一个位置,而URN指定一个名称。
#10
34
Another example I like to use when thinking about URIs is the xmlns attribute of an XML document:
在考虑uri时,我喜欢使用的另一个例子是XML文档的xmlns属性:
<rootElement xmlns:myPrefix="com.mycompany.mynode">
<myPrefix:aNode>some text</myPrefix:aNode>
</rootElement>
In this case com.mycompany.mynode would be a URI that uniquely identifies the "myPrefix" namespace for all of the elements that use it within my XML document. This is NOT a URL because it is only used to identify, not to locate something per se.
在这种情况下com.mycompany。mynode将是一个URI,它惟一地标识在我的XML文档中使用它的所有元素的“myPrefix”名称空间。这不是一个URL,因为它只用于标识,而不是定位某个东西本身。
#11
27
Due to difficulties to clearly distinguish between URI and URL, as far as I remember W3C does not make a difference any longer between URI and URL (http://www.w3.org/Addressing/).
由于很难清楚地区分URI和URL,我记得W3C在URI和URL之间不再有任何区别(http://www.w3.org/Addressing/)。
#12
22
Every URL(Uniform Resource Locator) is a URI(Uniform Resource Identifier), abstractly speaking, but every URI is not a URL. There is another subcategory of URI is URN (Uniform Resource Name), which is a name resources but do not specify how to locate them, like mailto, news, and isbn are URIs.
每个URL(统一资源定位符)是一个URI(统一资源标识符),抽象地说,但是每个URI都不是URL。URI的另一个子类是URN(统一资源名),它是一个名称资源,但是没有指定如何定位它们,例如mailto、news和isbn是URI。
Syntax for URN: [scheme:]scheme-specific-part[#fragment]
语法URN:[方案:]scheme-specific-part(#片段)
Examples:
mailto:java-net@java.sun.com
news:comp.lang.java
urn:isbn:096139210x
例子:mailto:java-net@java.sun.com新闻:comp.lang。java urn:isbn:096139210 x
Syntax for URL: [scheme:][//authority][path][?query][#fragment]
URL语法:[方案:][/ /权威][路径][?查询][#片段]
Examples:
http://java.sun.com/j2se/1.3/ docs/guide/collections/designfaq.html#28
../../../demo/jfc/SwingSet2/src/SwingSet2.java
file://host/dir/myfile.txt
示例:http://java.sun.com/j2se/1.3/文档/指导/ / designfaq集合。html # 28 . . / . . / . . /演示/ jfc / SwingSet2 / src / SwingSet2。java文件:/ /主机/ dir / myfile.txt
源
Analogy:
To reach a person : Driving(protocol others sms, email, phone), Address(hostname other phone-number, emailid) and person name(object name with relative path).
打个比方:要联系一个人:驾驶(其他短信、电子邮件、电话)、地址(主机名其他电话号码、emailid)和人名(相对路径的对象名)。
#13
22
First of all get your mind out of confusion and take it simple and you will understand.
首先,让你的头脑摆脱混乱,把它简单化,你就会明白。
URI => Uniform Resource Identifier Identifies a complete address of resource i-e location, name or both.
URI =>统一资源标识符标识资源i-e位置、名称或两者的完整地址。
URL => Uniform Resource Locator Identifies location of the resource.
URL =>统一资源定位器标识资源的位置。
URN => Uniform Resource Name Identifies the name of the resource
URN =>统一资源名标识资源的名称。
Example
例子
We have address https://www.google.com/folder/page.html where,
我们有地址https://www.google.com/folder/page.html,
URI(Uniform Resource Identifier) => https://www.google.com/folder/page.html
URI(统一资源标识符)=> https://www.google.com/folder/page.html。
URL(Uniform Resource Locator) => https://www.google.com/
URL(统一资源定位器)=> https://www.google.com/。
URN(Uniform Resource Name) => /folder/page.html
URN(统一资源名)=> /folder/page.html。
URI => (URL + URN) or URL only or URN only
URI => (URL + URN)或URL,只或URN。
#14
21
They're the same thing. A URI is a generalization of a URL. Originally, URIs were planned to be divided into URLs (addresses) and URNs (names) but then there was little difference between a URL and URI and http URIs were used as namespaces even though they didn't actually locate any resources.
他们是一样的。URI是URL的一般化。最初,URI计划被划分为URL(地址)和urn(名称),但是URL和URI和http URI之间几乎没有区别,尽管它们实际上并没有找到任何资源。
#15
18
URI is kind of the super class of URL's and URN's. Wikipedia has a fine article about them with links to the right set of RFCs.
URI是URL和URN的超类。*有一篇很好的文章,链接到正确的RFCs组。
#16
17
URI, URL, URN
URI,URL、URN
As the image above indicates, there are three distinct components at play here. It’s usually best to go to the source when discussing matters like these, so here’s an exerpt from Tim Berners-Lee, et. al. in RFC 3986: Uniform Resource Identifier (URI): Generic Syntax:
正如上图所示,这里有三个不同的组件。通常最好是在讨论这些问题的时候去找资料来源,所以这是来自于Tim Berners-Lee的一项工作,在RFC 3986:统一资源标识符(URI):通用语法:
A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource.
统一资源标识符(Uniform Resource Identifier, URI)是标识抽象或物理资源的紧凑序列。
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”).
URI可以进一步划分为定位器、名称或两者。术语“统一资源定位器”(URL)指的是uri的子集,除了标识资源外,还提供了通过描述其主要访问机制(例如,其网络“位置”)来定位资源的方法。
#17
14
URL
URL
A URL is a specialization of URI that defines the network location of a specific resource. Unlike a URN, the URL defines how the resource can be obtained. We use URLs every day in the form of http://example.com
etc. But a URL doesn't have to be an HTTP URL, it can be ftp://example.com
etc., too.
URL是URI的专门化,它定义特定资源的网络位置。与URN不同,URL定义了如何获取资源。我们每天都以http://example.com等形式使用URL,但URL不一定非得是HTTP URL,它也可以是ftp://example.com等等。
URI
URI
A URI identifies a resource either by location, or a name, or both. More often than not, most of us use URIs that defines a location to a resource. The fact that a URI can identify a resources by both name and location has lead to a lot of the confusion in my opinion. A URI has two specializations known as URL and URN.
URI通过位置、名称或两者都标识资源。通常情况下,我们大多数人使用uri来定义资源的位置。URI可以通过名称和位置标识资源,这导致了我的观点中的许多混乱。URI有两种专门化,即URL和URN。
Difference between URL and URI
URL和URI之间的差异。
A URI is an identifier for some resource, but a URL gives you specific information as to obtain that resource. A URI is a URL and as one commenter pointed out, it is now considered incorrect to use URL when describing applications. Generally, if the URL describes both the location and name of a resource, the term to use is URI. Since this is generally the case most of us encounter everyday, URI is the correct term.
URI是一些资源的标识符,但是URL提供了获取该资源的特定信息。URI是一个URL,正如一个评论者指出的,在描述应用程序时使用URL被认为是不正确的。通常,如果URL描述了资源的位置和名称,那么使用的术语是URI。由于这通常是我们大多数人每天都会遇到的情况,URI是正确的术语。
#18
14
Wikipedia will give all the information you need here. Quoting from http://en.wikipedia.org/wiki/URI:
*会提供你需要的所有信息。引用http://en.wikipedia.org/wiki/URI
A URL is a URI that, in addition to identifying a resource, provides means of acting upon or obtaining a representation of the resource by describing its primary access mechanism or network "location".
URL是一个URI,除了标识资源外,还提供了通过描述其主要访问机制或网络“位置”来执行或获取资源表示的方法。
#19
12
A URI identifies a resource either by location, or a name, or both. More often than not, most of us use URIs that defines a location to a resource. The fact that a URI can identify a resources by both name and location has lead to a lot of the confusion in my opinion. A URI has two specializations known as URL and URN.
URI通过位置、名称或两者都标识资源。通常情况下,我们大多数人使用uri来定义资源的位置。URI可以通过名称和位置标识资源,这导致了我的观点中的许多混乱。URI有两种专门化,即URL和URN。
A URL is a specialization of URI that defines the network location of a specific resource. Unlike a URN, the URL defines how the resource can be obtained. We use URLs every day in the form of http://*.com, etc. But a URL doesn’t have to be an HTTP URL, it can be ftp://example.com
, etc.
URL是URI的专门化,它定义特定资源的网络位置。与URN不同,URL定义了如何获取资源。我们每天都以http://*.com的形式使用URL,但URL不一定非得是HTTP URL,它可以是ftp://example.com等等。
#20
12
As per RFC 3986, URIs are comprised of the following pieces:
根据RFC 3986, uri由以下部分组成:
scheme://authority/path?query
The URI describes the protocol for accessing a resource (path) or application (query) on a server (authority).
URI描述了在服务器(权限)*问资源(路径)或应用程序(查询)的协议。
All the URLs are URIs, and all the URNs are URIs, but all the URIs are not URLs.
所有的url都是uri,所有的urn都是uri,但是所有uri都不是url。
Please refer for more details:
详情请参阅:
*
#21
10
Although the terms URI and URL are strictly defined, many use the terms for other things than they are defined for.
尽管术语URI和URL是严格定义的,但许多术语都是用来定义其他东西的。
Let’s take Apache for example. If http://example.com/foo is requested from an Apache server, you’ll have the following environment variables set:
让我们以Apache为例。如果从Apache服务器请求http://example.com/foo,则会设置以下环境变量:
-
REDIRECT_URL
:/foo
- REDIRECT_URL:/ foo
-
REQUEST_URI
:/foo
- REQUEST_URI:/ foo
With mod_rewrite enabled, you will also have these variables:
启用mod_rewrite后,您还将拥有这些变量:
-
REDIRECT_SCRIPT_URL
:/foo
- REDIRECT_SCRIPT_URL:/ foo
-
REDIRECT_SCRIPT_URI
:http://example.com/foo
- REDIRECT_SCRIPT_URI:http://example.com/foo
-
SCRIPT_URL
:/foo
- SCRIPT_URL:/ foo
-
SCRIPT_URI
:http://example.com/foo
- SCRIPT_URI:http://example.com/foo
This might be the reason for some of the confusion.
这可能是造成一些混乱的原因。
#22
9
See this document. Specifically,
看到这个文档。具体地说,
a 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.
URL是一种URI类型,它通过其主要访问机制(例如,其网络“位置”)的表示来标识资源,而不是通过它可能拥有的其他属性来标识资源。
It's not an extremely clear term, really.
这并不是一个非常明确的术语。
#23
8
After reading through the posts, I find some very relevant comments. In short, the confusion between the URL and URI definitions is based in part on which definition depends on which and also informal use of the word URI in software development.
在阅读完这些帖子之后,我发现了一些非常相关的评论。简而言之,URL和URI定义之间的混淆部分基于定义依赖于哪个定义,以及在软件开发中使用URI这个词的非正式用法。
By definition URL is a subset of URI [RFC2396]. URI contain URN and URL. Both URI and URL each have their own specific syntax that confers upon them the status of being either URI or URL. URN are for uniquely identifying a resource while URL are for locating a resource. Note that a resource can have more than one URL but only a single URN.[RFC2611]
根据定义URL是URI的子集[RFC2396]。URI包含URN和URL。URI和URL都有各自的特定语法,这些语法赋予它们作为URI或URL的状态。URN用于唯一标识资源,而URL用于定位资源。注意,资源可以有多个URL,但只有一个URN。
As web developers and programmers we will almost always be concerned with URL and therefore URI. Now a URL is specifically defined to have all the parts scheme:scheme-specific-part, like for example https://*.com/questions. This is a URL and it is also a URI. Now consider a relative link embedded in the page such as ../index.html. This is no longer a URL by definition. It is still what is referred to as a "URI-reference" [RFC2396].
作为web开发人员和程序员,我们几乎总是关注URL和URI。现在,一个URL被明确定义为包含所有的部分方案:方案的特定部分,例如https://*.com/questions。这是一个URL,它也是一个URI。现在考虑一个嵌入在页面中的相关链接,例如./index.html。这不再是一个定义的URL。它仍然被称为“uri引用”[RFC2396]。
I believe that when the word URI is used to refer to relative paths, "URI-reference" is actually what is being thought of. So informally, software systems use URI to refer to relative pathing and URL for the absolute address. So in this sense, a relative path is no longer a URL but still URI.
我相信,当“URI”这个词被用来指代相对路径时,“URI引用”实际上是被考虑的。因此,非正式地,软件系统使用URI来引用绝对地址的相对pathing和URL。因此,在这个意义上,相对路径不再是URL,而是URI。
#24
8
I was wondering about the same thing and I've found this: http://docs.kohanaphp.com/helpers/url.
我在想同样的事情,我发现了这个:http://docs.kohanaphp.com/helpers/url。
You can see a clear example using the url::current()
method. If you have this URL: http://example.com/kohana/index.php/welcome/home.html?query=string
then using url:current()
gives you the URI which, according to the documentation, is: welcome/home
您可以使用url::current()方法看到一个清晰的示例。如果您有这个URL: http://example.com/kohana/index.php/welcome/home.html?查询=字符串,然后使用url:current()给您一个URI,根据文档,它是:welcome/home。
#25
7
Here is my simplification:
这是我的简化:
URN: unique resource name, i.e. "what" (eg urn:issn:1234-5678 ). This is meant to be unique .. as in no two different docs can have the same urn. A bit like "uuid"
URN:唯一的资源名,即。“什么”(如urn:issn:1234 - 5678)。这是独一无二的。因为没有两个不同的文档可以有相同的urn。有点像“uuid”
URL: "where" to find it ( eg https://google.com/pub?issnid=1234-5678 .. or ftp://somesite.com/doc8.pdf )
网址:“where”找到它(如https://google.com/pub?)issnid = 1234 - 5678 . .或ftp://somesite.com/doc8.pdf)
URI: can be either a URN or a URL. This fuzzy definition is thanks to RFC 3986 produced by W3C and IETF.
URI:可以是URN或URL。这个模糊的定义要感谢W3C和IETF生产的RFC 3986。
The definition of URI has changed over the years, so it makes sense for most people to be confused. However, you can now take solace in the fact that you can refer to http://somesite.com/something as either a URL or URI ... an you will be right either way (at least fot the time being anyway...)
URI的定义在过去的几年中发生了变化,所以大多数人感到困惑是有意义的。然而,您现在可以通过引用http://somesite.com/something作为URL或URI来获得安慰。不管怎样,你都是对的(至少现在是时候了……)
#26
6
URIs came about from the need to identify resources on the Web, and other Internet resources such as electronic mailboxes in a uniform and coherent way. So, one can introduce a new type of widget: URIs to identify widget resources or use tel: URIs to have web links cause telephone calls to be made when invoked.
uri来自于需要在Web上识别资源,以及其他Internet资源,如电子邮箱的统一和一致的方式。因此,您可以引入一种新的小部件:uri来标识小部件资源或使用电话:uri具有web链接,从而在调用时发出电话。
Some URIs provide information to locate a resource (such as a DNS host name and a path on that machine), while some are used as pure resource names. The URL is reserved for identifiers that are resource locators, including 'http' URLs such as http://*.com, which identifies the web page at the given path on the host. Another example is 'mailto' URLs, such as mailto:fred@mail.org, which identifies the mailbox at the given address.
有些uri提供信息来定位资源(比如DNS主机名和机器上的路径),而有些则用作纯资源名。URL是为标识符而预留的,这些标识符是资源定位器,包括“http”URL,比如http://*.com,它标识主机上给定路径的web页面。另一个例子是“mailto”url,例如mailto:fred@mail.org,它标识给定地址的邮箱。
URNs are URIs that are used as pure resource names rather than locators. For example, the URI: mid:0E4FC272-5C02-11D9-B115-000A95B55BC8@*.com is a URN that identifies the email message containing it in its 'Message-Id' field. The URI serves to distinguish that message from any other email message. But it does not itself provide the message's address in any store.
urn是用作纯资源名称的uri,而不是定位器。例如,URI: mid:0E4FC272-5C02-11D9-B115-000A95B55BC8@*.com是一个URN,它标识包含在其“消息id”字段中的电子邮件消息。URI用于区分此消息与任何其他电子邮件消息。但它本身并不提供任何存储中的消息地址。
#27
5
Easy to explain:
容易解释:
Lets assume the following
让我们假设以下
URI is your Name
URI是你的名字
URL is your address with your name in-order to communicate with you.
URL是你的地址,你的名字是为了与你沟通。
-
my name is Loyola
我的名字叫洛约拉
Loyola is URI
罗耀拉是URI
-
my address is TN, Chennai 600001.
我的地址是Chennai 600001。
TN, Chennai 600 001, Loyola is URL
TN, Chennai 600001, Loyola是网址。
Hope you understand,
希望你理解,
Now lets see a precise example
现在我们来看一个具体的例子。
http://www.google.com/fistpage.html
http://www.google.com/fistpage.html
in the above you can communicate with a page called firstpage.html (URI) using following http://www.google.com/fistpage.html(URL).
在上面,您可以与一个名为firstpage的页面进行通信。html(URI)使用以下http://www.google.com/fistpage.html(URL)。
Hence URI is subset of URL but not vice-versa.
因此URI是URL的子集,但反之亦然。
#28
3
A Uniform Resource Identifier (URI) is a string of characters which identifies an Internet Resource.
统一资源标识符(Uniform Resource Identifier, URI)是标识Internet资源的字符串。
The most common URI is the Uniform Resource Locator (URL) which identifies an Internet domain address. Another, not so common type of URI is the Universal Resource Name (URN).
最常见的URI是标识Internet域地址的统一资源定位器(URL)。另一个不太常见的URI类型是通用资源名(URN)。
#29
3
In order to answer this I'll lean on an answer I modified to another question. A good example of a URI is how you identify an Amazon S3 resource. Let's take:
为了回答这个问题,我将依靠我对另一个问题的回答。URI的一个好例子就是如何标识Amazon S3资源。让我们来:
s3://www-example-com/index.html
[fig. 1]
s3:/ / www-example-com /索引。html(无花果。1]
which I created as a cached copy of
我创建的缓存副本?
http://www.example.com/index.html
[fig. 2]
http://www.example.com/index.html(无花果。2]
in Amazon's S3-US-West-2 datacenter.
在亚马逊的S3-US-West-2数据中心。
Even if * would allow me to hyperlink to the s3://
protocol scheme, it wouldn't do you any good in locating the resource. Because it Identifies a Resource, fig. 1 is a valid URI. It is also a valid URN, because Amazon requires that the bucket (their term for the authority
portion of the URI) be unique across datacenters. It is helpful in locating it, but it does not indicate the datacenter. Therefore it does not work as a URL.
即使*允许我超链接到s3://协议方案,在定位资源方面也不会有任何好处。因为它标识了一个资源,图1是一个有效的URI。它也是一个有效的URN,因为Amazon要求这个bucket(它们在URI的权限部分的术语)在数据中心中是惟一的。它有助于定位它,但它并不表示数据中心。因此,它不能作为一个URL。
So, how do URI, URL, and URN differ in this case?
那么,在这种情况下URI、URL和URN有什么不同呢?
- fig. 1 is a URI
- 图1是一个URI。
- fig. 1 is a URN
- 图1是一个瓮。
- fig. 2 is a URI
- 图2是一个URI。
- fig. 2 is a URL
- 图2是一个URL。
- The URL for fig. 1 is http://www-example-com.s3-website-us-west-2.amazonaws.com/
- also http://www-example-com.s3.amazonaws.com/index.html
- 同时http://www-example-com.s3.amazonaws.com/index.html
- but not http://www-example-com.s3.amazonaws.com/ (no datacenter and no filename is too generic for Amazon S3)
- 但不是http://www-example-com.s3.amazonaws.com/(没有数据中心,也没有文件名对于Amazon S3太通用)
- 图1的URL地址是http://www-example-com.s3-website-us-west-2.amazonaws.com/, http://www- examplecom.s3.amazonaws.com/index.html,但不是http://www-example-com.s3.amazonaws.com/(没有数据中心,也没有文件名对Amazon S3太通用)
NOTE: RFC 3986 defines URIs as scheme://authority/path?query#fragment
注:RFC 3986定义uri为scheme://权限/路径?查询#片段。
#30
2
I found:
我发现:
A uniform resource identifier(URI) represents something of a big picture. You can split URIs/ URIs can be classified as locators (uniform resource locators- URL), or as names (uniform resource name-URN), or either both. So basically, a URN functions like a person's name and the URL depicts that person's address. So long story short, a URN defines an item's identity, while the URL provides defines the method for finding it, finally encapsulating these two concepts is the URI
统一资源标识符(uniform resource identifier, URI)代表了一幅大图。可以将uri / uri划分为定位器(统一资源定位器- URL),或作为名称(统一资源名称- urn),或者两者都可以。基本上,一个URN函数就像一个人的名字,URL描述了那个人的地址。长话短说,一个URN定义了一个项目的标识,而URL提供了找到它的定义方法,最后封装了这两个概念是URI。
#1
1458
From RFC 3986:
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.
URI可以进一步划分为定位器、名称或两者。术语“统一资源定位器”(URL)指的是uri的子集,除了标识资源外,还提供了通过描述其主要访问机制(例如,其网络“位置”)来定位资源的方法。术语“统一资源名称”(URN)在历史上一直被用于指代“URN”计划(RFC2141)下的URI,它被要求在资源停止存在或不可用的情况下保持全局惟一和持久,以及具有名称属性的任何其他URI。
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.
所以所有的url都是uri(实际上不是很清楚),所有的urn都是uri——但是urn和url是不同的,所以你不能说所有uri都是url。
EDIT: I had previously thought that all URLs are valid URIs, but as per comments:
编辑:我以前认为所有的url都是有效的uri,但是根据评论:
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".不是“所有url都是uri”。这取决于对RFC的解释。例如,在Java中,URI解析器不喜欢(或),这是因为规范说“不应该”而不是“不应该”。
So that muddies the waters further, unfortunately.
因此,不幸的是,这种情况进一步恶化了海水。
If you haven't already read Roger Pate's answer, I'd advise doing so as well.
如果你还没有读过Roger Pate的答案,我建议你也这样做。
#2
3461
URIs identify and URLs locate; however, locators are also identifiers, so every URL is also a URI, but there are URIs which are not URLs.
uri标识和url定位;但是,定位器也是标识符,所以每个URL也是一个URI,但是URI不是URL。
Examples
- Roger Pate
- 罗杰脑袋
This is my name, which is an identifier. It is like a URI, but cannot be a URL, as it tells you nothing about my location or how to contact me. In this case it also happens to identify at least 5 other people in the USA alone.
这是我的名字,它是一个标识符。它就像一个URI,但不能是URL,因为它没有告诉您任何关于我的位置或如何联系我的信息。在这种情况下,仅在美国就会发现至少5个人。
- 4914 West Bay Street, Nassau, Bahamas
- 巴哈马拿骚西湾街4914号
This is a locator, which is an identifier for that physical location. It is like both a URL and URI (since all URLs are URIs), and also identifies me indirectly as "resident of..". In this case it uniquely identifies me, but that would change if I get a roommate.
这是一个定位器,它是物理位置的标识符。它就像一个URL和URI(因为所有URL都是URI),并且也间接地将我标识为“..”的居民。在这种情况下,它唯一地标识我,但如果我有一个室友,那就会改变。
I say "like" because these examples do not follow the required syntax.
我说“like”,因为这些示例不遵循所需的语法。
Popular confusion
From Wikipedia:
从*:
In computing, a Uniform Resource Locator (URL) is a subset of the Uniform Resource Identifier (URI) that specifies where an identified resource is available and the mechanism for retrieving it. In popular usage and in many technical documents and verbal discussions it is often incorrectly used as a synonym for URI, ... [emphasis mine]
在计算中,统一资源定位符(URL)是统一资源标识符(Uniform Resource Identifier, URI)的子集,该标识符指定了可用的标识资源的位置,以及检索该资源的机制。在流行的用法和许多技术文档和口头讨论中,它经常被错误地用作URI的同义词……(强调我的)
Because of this common confusion, many products and documentation incorrectly use one term instead of the other, assign their own distinction, or use them synonymously.
由于这种常见的混淆,许多产品和文档错误地使用一个术语而不是另一个术语,分配它们自己的区别,或者使用它们同义。
URNs
My name, Roger Pate, could be like a URN (Uniform Resource Name), except those are much more regulated and intended to be unique across both space and time.
我的名字,Roger Pate,可能像一个URN(统一的资源名),除了那些更规范,并且在空间和时间上都是独特的。
Because I currently share this name with other people, it's not globally unique and would not be appropriate as a URN. However, even if no other family used this name, I'm named after my paternal grandfather, so it still wouldn't be unique across time. And even if that wasn't the case, the possibility of naming my descendants after me make this unsuitable as a URN.
因为我现在和其他人分享这个名字,它不是全球唯一的,也不适合作为一个URN。然而,即使没有其他家庭使用这个名字,我还是以我祖父的名字命名,所以它仍然不会是唯一的跨越时间。即使事实并非如此,我的后代也有可能在我之后命名为URN。
URNs are different from URLs in this rigid uniqueness constraint, even though they both share the syntax of URIs.
在这种严格的唯一性约束中,urn不同于url,尽管它们都共享uri的语法。
#3
442
URI -- Uniform Resource Identifier
URIs are a standard for identifying documents using a short string of numbers, letters, and symbols. They are defined by RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax. URLs, URNs, and URCs are all types of URI.
uri是一种使用数字、字母和符号来标识文档的标准。它们由RFC 3986 -统一资源标识符(URI)定义:通用语法。url、urn和URCs都是URI的类型。
URL -- Uniform Resource Locator
Contains information about how to fetch a resource from its location. For example:
包含有关如何从其位置获取资源的信息。例如:
http://example.com/mypage.html
- http://example.com/mypage.html
ftp://example.com/download.zip
- ftp://example.com/download.zip
mailto:user@example.com
- mailto:user@example.com
file:///home/user/file.txt
- 文件:/ / / home / user / file.txt
tel:1-888-555-5555
- 电话号码:1-888-555-5555
http://example.com/resource?foo=bar#fragment
- http://example.com/resource?foo=bar片段
-
/other/link.html
(A relative URL, only useful in the context of another URL) - /其他/链接。html(相对URL,只在另一个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.
url总是以协议(http)开头,通常包含诸如网络主机名(example.com)和文档路径(/foo/mypage.html)等信息。url可能有查询参数和片段标识符。
URN -- Uniform Resource Name
Identifies a resource by a unique and persistent name, but doesn't necessarily tell you how to locate it on the internet. It usually starts with the prefix urn:
For example:
通过一个独特且持久的名称标识一个资源,但并不一定告诉您如何在internet上定位它。通常从前缀urn开始:例如:
-
urn:isbn:0451450523
to identify a book by its ISBN number. - urn:isbn:0451450523通过isbn号来识别一本书。
-
urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66
a globally unique identifier - urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66全球唯一标识符。
-
urn:publishing:book
- An XML namespace that identifies the document as a type of book. - 发布:book -一个XML名称空间,它将文档标识为一种类型的图书。
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.
urn可以识别想法和概念。它们不限于识别文件。当一个URN表示一个文档时,它可以被一个“解析器”翻译成一个URL。然后可以从URL下载该文档。
URC -- Uniform Resource Citation
Points to meta data about a document rather than to the document itself. An example of a URC is one that points to the HTML source code of a page like: view-source:http://example.com/
指向文档的元数据,而不是文档本身。URC的一个例子是指向一个页面的HTML源代码,比如:http://example.com/。
Data URI
Rather than locating it on the internet, or naming it, data can be placed directly into a URI. An example would be data:,Hello%20World
.
数据可以直接放在URI中,而不是在internet上定位或命名它。一个例子就是数据:Hello%20世界。
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.
HTML的W3规范说,锚标记的href可以包含URI,而不只是URL。您应该能够放入一个URN,例如。你的浏览器会将URN解析为一个URL并为你下载这本书。
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.
我并不知道,但现代web浏览器确实实现了数据URI方案。
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.)
不。相对和绝对url都是url(和uri)。
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.)
不。带有和没有查询参数的url都是url(和uri)。
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.)
不。带有和没有片段标识符的url都是url(和uri)。
Does the difference between URL and URI have anything to do with what characters are permitted?
No. URLs are defined to be a strict subset of URIs. If a parser allows a character in a URL but not in a URI, there is a bug in the parser. The specs go into great detail about which characters are allowed in which parts of URLs and URIs. Some characters may be allowed only in some parts of the URL, but characters alone are not a difference between URLs and URIs.
不。url被定义为uri的一个严格子集。如果解析器允许URL中的字符而不是URI,则解析器中有一个错误。该规范详细介绍了哪些字符可以在哪些url和uri中使用。有些字符只允许在URL的某些部分,但是字符本身并不是URL和uri之间的区别。
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.
是的。W3C意识到对此有很多困惑。他们发布了一个URI澄清文档,该文档表示现在可以将URL和URI互换(表示URI)。将uri划分为URL、URN和URC等不同类型的uri不再有用。
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.
URN的定义现在比我上面说的要宽松。URIs的最新RFC表示,任何URI现在都可以是URN(无论它是从URN开始的),只要它具有“名称的属性”。也就是说,即使资源停止存在或不可用,它仍然是全局惟一和持久的。示例:在HTML doctype中使用的uri,如http://www.w3.org/TR/html4/strict.dtd。即使w3.org网站上的页面被删除,这个URI仍然会继续命名HTML4过渡型doctype。
#4
227
In summary: a URI identifies, a URL identifies and locates.
总结:一个URI标识,一个URL标识和定位。
Consider a specific edition of Shakespeare's play Romeo and Juliet, of which you have a digital copy on your home network.
考虑一个特定版本的莎士比亚戏剧《罗密欧与朱丽叶》,其中你的家庭网络上有一个数字拷贝。
You could identify the text as urn:isbn:0-486-27557-4
.
That would be a URI, but more specifically a URN* because it names the text.
您可以将文本定义为urn:isbn:0-486-27557-4。这将是一个URI,但更具体地说是一个URN*,因为它命名了文本。
You could also identify the text as file://hostname/sharename/RomeoAndJuliet.pdf
.
That would also be a URI, but more specifically a URL because it locates the text.
您还可以将文本标识为文件://hostname/sharename/RomeoAndJuliet.pdf。这也将是一个URI,但更具体地说是一个URL,因为它定位了文本。
*Uniform Resource Name
*统一资源名称
(Note that my example is adapted from Wikipedia)
(请注意,我的例子是根据*改编的)
#5
123
These are some very well-written but long-winded answers. Here is the difference as far as CodeIgniter is concerned:
这些都是一些写得很好的但冗长的答案。这里是关于CodeIgniter的不同之处:
URL - http://example.com/some/page.html
URL http://example.com/some/page.html
URI - /some/page.html
URI - /一些/ page.html
Put simply, URL is the full way to indentify any resource anywhere and can have different protocols like FTP, HTTP, SCP, etc.
简单地说,URL是识别任何地方的任何资源的完整方法,并且可以有不同的协议,如FTP、HTTP、SCP等。
URI is a resource on the current domain, so it needs less information to be found.
URI是当前域中的一个资源,因此它需要找到的信息更少。
In every instance that CodeIgniter uses the word URL or URI this is the difference they are talking about, though in the grand-scheme of the web, it is not 100% correct.
在CodeIgniter使用URL或URI的每个实例中,这是他们所讨论的差异,尽管在web的grand-scheme中,它不是100%正确的。
#6
81
URI -> Uniform Resource Identifier
URI ->统一资源标识符。
- URI is a text which is used to identify any resource or name on Internet.
- URI是用于在Internet上标识任何资源或名称的文本。
- URI has two specializations in the form of URL (Uniform Resource Locator) and URN (Uniform Resource Name)
- URI以URL(统一资源定位符)和URN(统一资源名)的形式有两个专门化
- This two specifications are used to identify resource and name.
- 这两个规范用于标识资源和名称。
URL -> Uniform Resource Locator
URL ->统一资源定位器。
- It is a subset of URI
- 它是URI的子集。
- URL includes location as well as the protocol to retrieve the resource (For example :HTTP Protocol is used to retrive resource)
- URL包括检索资源的位置和协议(例如:HTTP协议用于检索资源)
URN -> Uniform Resource Name
URN ->统一资源名。
- It is also a subset of URI
- 它也是URI的子集。
- URN is completely different than URL as it doesn't include any protocol.
- URN与URL完全不同,因为它不包含任何协议。
Diference between URI,URL and URN
URI、URL和URN之间的差异。
1) Every URL and URN is URI because URI is the superset of both URL and URN.
1)每个URL和URN都是URI,因为URI是URL和URN的超集。
2) URL includes protocol e.g. http://, ftp:// along with location to identify resource e.g. http://www.blogspot.com/abc.html.
2)URL包括协议,例如http://, ftp://和位置识别资源,例如http://www.blogspot.com/abc.html。
3) URN are the unambiguous way to identify a resource. ISBN numbers are best examples of URN
3)URN是确定资源的明确方法。ISBN数字是URN的最好例子。
#7
62
A small addition to the answers already posted, here's a Venn's diagram to sum up the theory (from Prateek Joshi's beautiful explanation):
在已经发布的答案中,有一个小的补充,下面是一个维恩的图表来总结这个理论(从Prateek Joshi的美丽解释):
And an example (also from Prateek's website):
还有一个例子(来自Prateek网站):
#8
51
This is one of the most confusing and possibly irrelevant topics I've encountered as a web professional.
这是我作为一个网络专家遇到的最令人困惑和可能不相关的话题之一。
As I understand it, a URI is a description of something, following an accepted format, that can define both or either the unique name (identification) of something and its location.
正如我所理解的,URI是对某物的描述,它遵循一种被接受的格式,它可以定义某物的唯一名称(标识)和它的位置。
There are two basic subsets - URLs, which define location (especially to a browser trying to look up a webpage) and URNs, which define the unique name of something.
有两个基本的子集——url,它定义了位置(特别是浏览器试图查找网页)和urn,它定义了某个东西的唯一名称。
I tend to think of URNs as being similar to GUIDs. They are simply a standardized methodology for providing unique names for things. As in the namespace declarative that uses a company's name - it's not like there is a resource sitting on a server somewhere to correspond to that line of text - it simply uniquely identifies something.
我倾向于认为urn类似于GUIDs。它们只是为事物提供唯一名称的标准化方法。就像使用公司名称的名称空间声明一样——它不像在服务器上有一种资源可以对应于这一行文本——它只是唯一地标识某些东西。
I also tend to completely avoid the term URI and discuss things only in terms of URL or URN as appropriate, because it causes so much confusion. The question we should really try answering for people isn't so much the semantics, but how to identify when encountering the terms whether or not there is any practical difference in them that will change the approach to a programming situation. For example, if someone corrects me in conversation and says, "oh, that's not a URL it's a URI" I know they're full of it. If someone says "we're using a URN to define the resource" I'm more likely to understand we are only naming it uniquely, not locating it on a server.
我也倾向于完全避免使用术语URI,并且只在URL或URN上讨论事情,因为它会引起如此多的混乱。我们真正应该尝试回答的问题不是语义,而是如何识别遇到的术语是否有实际的差异,这将改变编程环境的方法。例如,如果有人在对话中纠正我说,“哦,那不是URL,它是一个URI”,我知道他们都是这样。如果有人说“我们正在使用URN来定义资源”,我更可能理解我们只是将其命名为惟一的,而不是将其定位在服务器上。
If I'm way off base - please let me know!
如果我离开基地,请告诉我!
#9
40
URI => http://en.wikipedia.org/wiki/Uniform_Resource_Identifier
URI http://en.wikipedia.org/wiki/Uniform_Resource_Identifier = >
URL's are a subset of URI's (which also contain URNs).
URL是URI(也包含urn)的子集。
Basically, a URI is a general identifier, where a URL specifies a location and a URN specifies a name.
基本上,URI是一个通用标识符,URL指定一个位置,而URN指定一个名称。
#10
34
Another example I like to use when thinking about URIs is the xmlns attribute of an XML document:
在考虑uri时,我喜欢使用的另一个例子是XML文档的xmlns属性:
<rootElement xmlns:myPrefix="com.mycompany.mynode">
<myPrefix:aNode>some text</myPrefix:aNode>
</rootElement>
In this case com.mycompany.mynode would be a URI that uniquely identifies the "myPrefix" namespace for all of the elements that use it within my XML document. This is NOT a URL because it is only used to identify, not to locate something per se.
在这种情况下com.mycompany。mynode将是一个URI,它惟一地标识在我的XML文档中使用它的所有元素的“myPrefix”名称空间。这不是一个URL,因为它只用于标识,而不是定位某个东西本身。
#11
27
Due to difficulties to clearly distinguish between URI and URL, as far as I remember W3C does not make a difference any longer between URI and URL (http://www.w3.org/Addressing/).
由于很难清楚地区分URI和URL,我记得W3C在URI和URL之间不再有任何区别(http://www.w3.org/Addressing/)。
#12
22
Every URL(Uniform Resource Locator) is a URI(Uniform Resource Identifier), abstractly speaking, but every URI is not a URL. There is another subcategory of URI is URN (Uniform Resource Name), which is a name resources but do not specify how to locate them, like mailto, news, and isbn are URIs.
每个URL(统一资源定位符)是一个URI(统一资源标识符),抽象地说,但是每个URI都不是URL。URI的另一个子类是URN(统一资源名),它是一个名称资源,但是没有指定如何定位它们,例如mailto、news和isbn是URI。
Syntax for URN: [scheme:]scheme-specific-part[#fragment]
语法URN:[方案:]scheme-specific-part(#片段)
Examples:
mailto:java-net@java.sun.com
news:comp.lang.java
urn:isbn:096139210x
例子:mailto:java-net@java.sun.com新闻:comp.lang。java urn:isbn:096139210 x
Syntax for URL: [scheme:][//authority][path][?query][#fragment]
URL语法:[方案:][/ /权威][路径][?查询][#片段]
Examples:
http://java.sun.com/j2se/1.3/ docs/guide/collections/designfaq.html#28
../../../demo/jfc/SwingSet2/src/SwingSet2.java
file://host/dir/myfile.txt
示例:http://java.sun.com/j2se/1.3/文档/指导/ / designfaq集合。html # 28 . . / . . / . . /演示/ jfc / SwingSet2 / src / SwingSet2。java文件:/ /主机/ dir / myfile.txt
源
Analogy:
To reach a person : Driving(protocol others sms, email, phone), Address(hostname other phone-number, emailid) and person name(object name with relative path).
打个比方:要联系一个人:驾驶(其他短信、电子邮件、电话)、地址(主机名其他电话号码、emailid)和人名(相对路径的对象名)。
#13
22
First of all get your mind out of confusion and take it simple and you will understand.
首先,让你的头脑摆脱混乱,把它简单化,你就会明白。
URI => Uniform Resource Identifier Identifies a complete address of resource i-e location, name or both.
URI =>统一资源标识符标识资源i-e位置、名称或两者的完整地址。
URL => Uniform Resource Locator Identifies location of the resource.
URL =>统一资源定位器标识资源的位置。
URN => Uniform Resource Name Identifies the name of the resource
URN =>统一资源名标识资源的名称。
Example
例子
We have address https://www.google.com/folder/page.html where,
我们有地址https://www.google.com/folder/page.html,
URI(Uniform Resource Identifier) => https://www.google.com/folder/page.html
URI(统一资源标识符)=> https://www.google.com/folder/page.html。
URL(Uniform Resource Locator) => https://www.google.com/
URL(统一资源定位器)=> https://www.google.com/。
URN(Uniform Resource Name) => /folder/page.html
URN(统一资源名)=> /folder/page.html。
URI => (URL + URN) or URL only or URN only
URI => (URL + URN)或URL,只或URN。
#14
21
They're the same thing. A URI is a generalization of a URL. Originally, URIs were planned to be divided into URLs (addresses) and URNs (names) but then there was little difference between a URL and URI and http URIs were used as namespaces even though they didn't actually locate any resources.
他们是一样的。URI是URL的一般化。最初,URI计划被划分为URL(地址)和urn(名称),但是URL和URI和http URI之间几乎没有区别,尽管它们实际上并没有找到任何资源。
#15
18
URI is kind of the super class of URL's and URN's. Wikipedia has a fine article about them with links to the right set of RFCs.
URI是URL和URN的超类。*有一篇很好的文章,链接到正确的RFCs组。
#16
17
URI, URL, URN
URI,URL、URN
As the image above indicates, there are three distinct components at play here. It’s usually best to go to the source when discussing matters like these, so here’s an exerpt from Tim Berners-Lee, et. al. in RFC 3986: Uniform Resource Identifier (URI): Generic Syntax:
正如上图所示,这里有三个不同的组件。通常最好是在讨论这些问题的时候去找资料来源,所以这是来自于Tim Berners-Lee的一项工作,在RFC 3986:统一资源标识符(URI):通用语法:
A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource.
统一资源标识符(Uniform Resource Identifier, URI)是标识抽象或物理资源的紧凑序列。
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”).
URI可以进一步划分为定位器、名称或两者。术语“统一资源定位器”(URL)指的是uri的子集,除了标识资源外,还提供了通过描述其主要访问机制(例如,其网络“位置”)来定位资源的方法。
#17
14
URL
URL
A URL is a specialization of URI that defines the network location of a specific resource. Unlike a URN, the URL defines how the resource can be obtained. We use URLs every day in the form of http://example.com
etc. But a URL doesn't have to be an HTTP URL, it can be ftp://example.com
etc., too.
URL是URI的专门化,它定义特定资源的网络位置。与URN不同,URL定义了如何获取资源。我们每天都以http://example.com等形式使用URL,但URL不一定非得是HTTP URL,它也可以是ftp://example.com等等。
URI
URI
A URI identifies a resource either by location, or a name, or both. More often than not, most of us use URIs that defines a location to a resource. The fact that a URI can identify a resources by both name and location has lead to a lot of the confusion in my opinion. A URI has two specializations known as URL and URN.
URI通过位置、名称或两者都标识资源。通常情况下,我们大多数人使用uri来定义资源的位置。URI可以通过名称和位置标识资源,这导致了我的观点中的许多混乱。URI有两种专门化,即URL和URN。
Difference between URL and URI
URL和URI之间的差异。
A URI is an identifier for some resource, but a URL gives you specific information as to obtain that resource. A URI is a URL and as one commenter pointed out, it is now considered incorrect to use URL when describing applications. Generally, if the URL describes both the location and name of a resource, the term to use is URI. Since this is generally the case most of us encounter everyday, URI is the correct term.
URI是一些资源的标识符,但是URL提供了获取该资源的特定信息。URI是一个URL,正如一个评论者指出的,在描述应用程序时使用URL被认为是不正确的。通常,如果URL描述了资源的位置和名称,那么使用的术语是URI。由于这通常是我们大多数人每天都会遇到的情况,URI是正确的术语。
#18
14
Wikipedia will give all the information you need here. Quoting from http://en.wikipedia.org/wiki/URI:
*会提供你需要的所有信息。引用http://en.wikipedia.org/wiki/URI
A URL is a URI that, in addition to identifying a resource, provides means of acting upon or obtaining a representation of the resource by describing its primary access mechanism or network "location".
URL是一个URI,除了标识资源外,还提供了通过描述其主要访问机制或网络“位置”来执行或获取资源表示的方法。
#19
12
A URI identifies a resource either by location, or a name, or both. More often than not, most of us use URIs that defines a location to a resource. The fact that a URI can identify a resources by both name and location has lead to a lot of the confusion in my opinion. A URI has two specializations known as URL and URN.
URI通过位置、名称或两者都标识资源。通常情况下,我们大多数人使用uri来定义资源的位置。URI可以通过名称和位置标识资源,这导致了我的观点中的许多混乱。URI有两种专门化,即URL和URN。
A URL is a specialization of URI that defines the network location of a specific resource. Unlike a URN, the URL defines how the resource can be obtained. We use URLs every day in the form of http://*.com, etc. But a URL doesn’t have to be an HTTP URL, it can be ftp://example.com
, etc.
URL是URI的专门化,它定义特定资源的网络位置。与URN不同,URL定义了如何获取资源。我们每天都以http://*.com的形式使用URL,但URL不一定非得是HTTP URL,它可以是ftp://example.com等等。
#20
12
As per RFC 3986, URIs are comprised of the following pieces:
根据RFC 3986, uri由以下部分组成:
scheme://authority/path?query
The URI describes the protocol for accessing a resource (path) or application (query) on a server (authority).
URI描述了在服务器(权限)*问资源(路径)或应用程序(查询)的协议。
All the URLs are URIs, and all the URNs are URIs, but all the URIs are not URLs.
所有的url都是uri,所有的urn都是uri,但是所有uri都不是url。
Please refer for more details:
详情请参阅:
*
#21
10
Although the terms URI and URL are strictly defined, many use the terms for other things than they are defined for.
尽管术语URI和URL是严格定义的,但许多术语都是用来定义其他东西的。
Let’s take Apache for example. If http://example.com/foo is requested from an Apache server, you’ll have the following environment variables set:
让我们以Apache为例。如果从Apache服务器请求http://example.com/foo,则会设置以下环境变量:
-
REDIRECT_URL
:/foo
- REDIRECT_URL:/ foo
-
REQUEST_URI
:/foo
- REQUEST_URI:/ foo
With mod_rewrite enabled, you will also have these variables:
启用mod_rewrite后,您还将拥有这些变量:
-
REDIRECT_SCRIPT_URL
:/foo
- REDIRECT_SCRIPT_URL:/ foo
-
REDIRECT_SCRIPT_URI
:http://example.com/foo
- REDIRECT_SCRIPT_URI:http://example.com/foo
-
SCRIPT_URL
:/foo
- SCRIPT_URL:/ foo
-
SCRIPT_URI
:http://example.com/foo
- SCRIPT_URI:http://example.com/foo
This might be the reason for some of the confusion.
这可能是造成一些混乱的原因。
#22
9
See this document. Specifically,
看到这个文档。具体地说,
a 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.
URL是一种URI类型,它通过其主要访问机制(例如,其网络“位置”)的表示来标识资源,而不是通过它可能拥有的其他属性来标识资源。
It's not an extremely clear term, really.
这并不是一个非常明确的术语。
#23
8
After reading through the posts, I find some very relevant comments. In short, the confusion between the URL and URI definitions is based in part on which definition depends on which and also informal use of the word URI in software development.
在阅读完这些帖子之后,我发现了一些非常相关的评论。简而言之,URL和URI定义之间的混淆部分基于定义依赖于哪个定义,以及在软件开发中使用URI这个词的非正式用法。
By definition URL is a subset of URI [RFC2396]. URI contain URN and URL. Both URI and URL each have their own specific syntax that confers upon them the status of being either URI or URL. URN are for uniquely identifying a resource while URL are for locating a resource. Note that a resource can have more than one URL but only a single URN.[RFC2611]
根据定义URL是URI的子集[RFC2396]。URI包含URN和URL。URI和URL都有各自的特定语法,这些语法赋予它们作为URI或URL的状态。URN用于唯一标识资源,而URL用于定位资源。注意,资源可以有多个URL,但只有一个URN。
As web developers and programmers we will almost always be concerned with URL and therefore URI. Now a URL is specifically defined to have all the parts scheme:scheme-specific-part, like for example https://*.com/questions. This is a URL and it is also a URI. Now consider a relative link embedded in the page such as ../index.html. This is no longer a URL by definition. It is still what is referred to as a "URI-reference" [RFC2396].
作为web开发人员和程序员,我们几乎总是关注URL和URI。现在,一个URL被明确定义为包含所有的部分方案:方案的特定部分,例如https://*.com/questions。这是一个URL,它也是一个URI。现在考虑一个嵌入在页面中的相关链接,例如./index.html。这不再是一个定义的URL。它仍然被称为“uri引用”[RFC2396]。
I believe that when the word URI is used to refer to relative paths, "URI-reference" is actually what is being thought of. So informally, software systems use URI to refer to relative pathing and URL for the absolute address. So in this sense, a relative path is no longer a URL but still URI.
我相信,当“URI”这个词被用来指代相对路径时,“URI引用”实际上是被考虑的。因此,非正式地,软件系统使用URI来引用绝对地址的相对pathing和URL。因此,在这个意义上,相对路径不再是URL,而是URI。
#24
8
I was wondering about the same thing and I've found this: http://docs.kohanaphp.com/helpers/url.
我在想同样的事情,我发现了这个:http://docs.kohanaphp.com/helpers/url。
You can see a clear example using the url::current()
method. If you have this URL: http://example.com/kohana/index.php/welcome/home.html?query=string
then using url:current()
gives you the URI which, according to the documentation, is: welcome/home
您可以使用url::current()方法看到一个清晰的示例。如果您有这个URL: http://example.com/kohana/index.php/welcome/home.html?查询=字符串,然后使用url:current()给您一个URI,根据文档,它是:welcome/home。
#25
7
Here is my simplification:
这是我的简化:
URN: unique resource name, i.e. "what" (eg urn:issn:1234-5678 ). This is meant to be unique .. as in no two different docs can have the same urn. A bit like "uuid"
URN:唯一的资源名,即。“什么”(如urn:issn:1234 - 5678)。这是独一无二的。因为没有两个不同的文档可以有相同的urn。有点像“uuid”
URL: "where" to find it ( eg https://google.com/pub?issnid=1234-5678 .. or ftp://somesite.com/doc8.pdf )
网址:“where”找到它(如https://google.com/pub?)issnid = 1234 - 5678 . .或ftp://somesite.com/doc8.pdf)
URI: can be either a URN or a URL. This fuzzy definition is thanks to RFC 3986 produced by W3C and IETF.
URI:可以是URN或URL。这个模糊的定义要感谢W3C和IETF生产的RFC 3986。
The definition of URI has changed over the years, so it makes sense for most people to be confused. However, you can now take solace in the fact that you can refer to http://somesite.com/something as either a URL or URI ... an you will be right either way (at least fot the time being anyway...)
URI的定义在过去的几年中发生了变化,所以大多数人感到困惑是有意义的。然而,您现在可以通过引用http://somesite.com/something作为URL或URI来获得安慰。不管怎样,你都是对的(至少现在是时候了……)
#26
6
URIs came about from the need to identify resources on the Web, and other Internet resources such as electronic mailboxes in a uniform and coherent way. So, one can introduce a new type of widget: URIs to identify widget resources or use tel: URIs to have web links cause telephone calls to be made when invoked.
uri来自于需要在Web上识别资源,以及其他Internet资源,如电子邮箱的统一和一致的方式。因此,您可以引入一种新的小部件:uri来标识小部件资源或使用电话:uri具有web链接,从而在调用时发出电话。
Some URIs provide information to locate a resource (such as a DNS host name and a path on that machine), while some are used as pure resource names. The URL is reserved for identifiers that are resource locators, including 'http' URLs such as http://*.com, which identifies the web page at the given path on the host. Another example is 'mailto' URLs, such as mailto:fred@mail.org, which identifies the mailbox at the given address.
有些uri提供信息来定位资源(比如DNS主机名和机器上的路径),而有些则用作纯资源名。URL是为标识符而预留的,这些标识符是资源定位器,包括“http”URL,比如http://*.com,它标识主机上给定路径的web页面。另一个例子是“mailto”url,例如mailto:fred@mail.org,它标识给定地址的邮箱。
URNs are URIs that are used as pure resource names rather than locators. For example, the URI: mid:0E4FC272-5C02-11D9-B115-000A95B55BC8@*.com is a URN that identifies the email message containing it in its 'Message-Id' field. The URI serves to distinguish that message from any other email message. But it does not itself provide the message's address in any store.
urn是用作纯资源名称的uri,而不是定位器。例如,URI: mid:0E4FC272-5C02-11D9-B115-000A95B55BC8@*.com是一个URN,它标识包含在其“消息id”字段中的电子邮件消息。URI用于区分此消息与任何其他电子邮件消息。但它本身并不提供任何存储中的消息地址。
#27
5
Easy to explain:
容易解释:
Lets assume the following
让我们假设以下
URI is your Name
URI是你的名字
URL is your address with your name in-order to communicate with you.
URL是你的地址,你的名字是为了与你沟通。
-
my name is Loyola
我的名字叫洛约拉
Loyola is URI
罗耀拉是URI
-
my address is TN, Chennai 600001.
我的地址是Chennai 600001。
TN, Chennai 600 001, Loyola is URL
TN, Chennai 600001, Loyola是网址。
Hope you understand,
希望你理解,
Now lets see a precise example
现在我们来看一个具体的例子。
http://www.google.com/fistpage.html
http://www.google.com/fistpage.html
in the above you can communicate with a page called firstpage.html (URI) using following http://www.google.com/fistpage.html(URL).
在上面,您可以与一个名为firstpage的页面进行通信。html(URI)使用以下http://www.google.com/fistpage.html(URL)。
Hence URI is subset of URL but not vice-versa.
因此URI是URL的子集,但反之亦然。
#28
3
A Uniform Resource Identifier (URI) is a string of characters which identifies an Internet Resource.
统一资源标识符(Uniform Resource Identifier, URI)是标识Internet资源的字符串。
The most common URI is the Uniform Resource Locator (URL) which identifies an Internet domain address. Another, not so common type of URI is the Universal Resource Name (URN).
最常见的URI是标识Internet域地址的统一资源定位器(URL)。另一个不太常见的URI类型是通用资源名(URN)。
#29
3
In order to answer this I'll lean on an answer I modified to another question. A good example of a URI is how you identify an Amazon S3 resource. Let's take:
为了回答这个问题,我将依靠我对另一个问题的回答。URI的一个好例子就是如何标识Amazon S3资源。让我们来:
s3://www-example-com/index.html
[fig. 1]
s3:/ / www-example-com /索引。html(无花果。1]
which I created as a cached copy of
我创建的缓存副本?
http://www.example.com/index.html
[fig. 2]
http://www.example.com/index.html(无花果。2]
in Amazon's S3-US-West-2 datacenter.
在亚马逊的S3-US-West-2数据中心。
Even if * would allow me to hyperlink to the s3://
protocol scheme, it wouldn't do you any good in locating the resource. Because it Identifies a Resource, fig. 1 is a valid URI. It is also a valid URN, because Amazon requires that the bucket (their term for the authority
portion of the URI) be unique across datacenters. It is helpful in locating it, but it does not indicate the datacenter. Therefore it does not work as a URL.
即使*允许我超链接到s3://协议方案,在定位资源方面也不会有任何好处。因为它标识了一个资源,图1是一个有效的URI。它也是一个有效的URN,因为Amazon要求这个bucket(它们在URI的权限部分的术语)在数据中心中是惟一的。它有助于定位它,但它并不表示数据中心。因此,它不能作为一个URL。
So, how do URI, URL, and URN differ in this case?
那么,在这种情况下URI、URL和URN有什么不同呢?
- fig. 1 is a URI
- 图1是一个URI。
- fig. 1 is a URN
- 图1是一个瓮。
- fig. 2 is a URI
- 图2是一个URI。
- fig. 2 is a URL
- 图2是一个URL。
- The URL for fig. 1 is http://www-example-com.s3-website-us-west-2.amazonaws.com/
- also http://www-example-com.s3.amazonaws.com/index.html
- 同时http://www-example-com.s3.amazonaws.com/index.html
- but not http://www-example-com.s3.amazonaws.com/ (no datacenter and no filename is too generic for Amazon S3)
- 但不是http://www-example-com.s3.amazonaws.com/(没有数据中心,也没有文件名对于Amazon S3太通用)
- 图1的URL地址是http://www-example-com.s3-website-us-west-2.amazonaws.com/, http://www- examplecom.s3.amazonaws.com/index.html,但不是http://www-example-com.s3.amazonaws.com/(没有数据中心,也没有文件名对Amazon S3太通用)
NOTE: RFC 3986 defines URIs as scheme://authority/path?query#fragment
注:RFC 3986定义uri为scheme://权限/路径?查询#片段。
#30
2
I found:
我发现:
A uniform resource identifier(URI) represents something of a big picture. You can split URIs/ URIs can be classified as locators (uniform resource locators- URL), or as names (uniform resource name-URN), or either both. So basically, a URN functions like a person's name and the URL depicts that person's address. So long story short, a URN defines an item's identity, while the URL provides defines the method for finding it, finally encapsulating these two concepts is the URI
统一资源标识符(uniform resource identifier, URI)代表了一幅大图。可以将uri / uri划分为定位器(统一资源定位器- URL),或作为名称(统一资源名称- urn),或者两者都可以。基本上,一个URN函数就像一个人的名字,URL描述了那个人的地址。长话短说,一个URN定义了一个项目的标识,而URL提供了找到它的定义方法,最后封装了这两个概念是URI。