The difference between a URI and a URL

Source: Internet
Author: User
Tags gopher url example ftp access

(original URL: http://zhidao.baidu.com/question/38764759.html)
Each resource available on the Web-HTML documents, images, video clips, programs, and so on-is positioned by a generic resource identifier (Universal Resource Identifier, referred to as the "URI").
1.URI is generally made up of three parts:
2. Access the resource naming mechanism.
3. Host name of the resource to be stored.
4. The name of the resource itself, represented by the path.
Consider the following URI, which represents the current HTML 4.0 specification:
http://www.webmonkey.com.cn/html/html40/
This URI is: This is a resource that can be accessed through the HTTP protocol, located on the host www.webmonkey.com.cn, accessed through the path "/HTML/HTML40". Other resources in the HTML document include "mailto" (sending and receiving email and "FTP" (FTP access).
This is another example of a URI that points to a user's mailbox:
<a href= "Joe ' >mailto:[email protected]" >joe cool</a>
Note: Most readers may be familiar with "URLs" rather than URIs. A URL is a subset of the Rui naming mechanism.
Fragment marker
Some URIs point to the inside of a resource. This URI ends with a "#" and follows a anchor flag
Symbols (called fragment markers). For example, here is a URI that points to section_2:
Http://somesite.com/html/top.htm#section_2
Relative URI
The relative URI does not contain any naming specification information. Its path usually refers to resources on the same machine. Phase
The URI may contain a relative path (for example, "..") Represents the previous layer path) and may also contain the fragment label
The log character.
To illustrate the relative URI, let's say we have a basic URI http://www.acme.com/support/intro.htm
Relative URIs are used in the following links:
<a href= "suppliers.htm" >Suppliers</A>
It expands into a full URI that is "http://www.acme.com/support/suppliers.htm",
The following is the relative URI of an image:

It expands into a full URI that is "http://www.acme.com/icons/logo.gif".
In HTML, URIs are used to:
Link to another document or resource (see A and link elements).
Link to an external style sheet or script (see link and scripting elements).
Include images, objects, or applets within the page (see Imag, Object, applet, and input
Element).
Create an image map (see map and area elements).
Submit a form (see form).
Create a framework document (see Frame and IFRAME elements).
Refer to an external reference (see Q, BLOCKQUOTE, ins, and Del elements).
Point to a metadata that describes the document (see Head Element).

2. What is a URL:
The URL is the abbreviation for uniform resourcelocation, translated as "Uniform Resource Locator." In layman's words, URLs are strings used on the Internet to describe information resources, mainly used in various WWW client programs and server programs, especially the famous mosaic. URLs can be used in a unified format to describe various information resources, including files, server addresses and directories.
Format of the ◇url
The format of the URL consists of the following three parts:
The first part is the agreement (or service mode);
The second part is the host IP address (and sometimes the port number) where the resource is stored;
The third part is the specific address of the host resource. , such as directory and file name.
The first and second sections are separated by a "://" Symbol, and the second and third sections are separated by a "/" symbol. The first part and the second part are indispensable, and the third part can be omitted sometimes.
◇url Example
URL of the file:
When a file is represented by a URL, the server is represented by a filename, followed by information such as the host IP address, the access path (that is, the directory), and the file name. Directories and file names can sometimes be omitted, but the "/" symbol cannot be omitted.
Example one: File://ftp.yoyodyne.com/pub/files/foobar.txt
Represents a file under the Pub/files/directory on the host ftp.yoyodyne.com, and the filename is foobar.txt.
Example two: file://ftp.yoyodyne.com/pub
Represents the directory/pub on the host ftp.yoyodyne.com.
Example three: file://ftp.yoyodyne.com/
Represents the root directory on the host ftp.yoyodyne.com.
URL for Gopher:
The gopher server may use a special port, in which case the host IP address should be separated from the port with ":".
Example one: gopher://gopher.yoyodyne.com/
Represents the gopher server on the host gopher.yoyodyne.com.
Example two: gopher://gopher.banzai.edu:1234
Represents the gopher server on the host gopher.banzai.edu on port 1234.
URL for Web news:
When using a URL to represent a network newsgroup, if it is Usenet, just specify the name of the newsgroup.
Example: news:rec.gardening
Represents a rec.gardening newsgroup (gardening) on Usenet.
URL for http:
Use Hypertext Transfer Protocol HTTP to provide resources for hypertext information Services.
Example one: http://www.peopledaily.com.cn/channel/welcome.htm
Its computer domain name is www.peopledaily.com.cn. The hypertext file (the file type is. html) is the welcome.htm under the directory/channel. This is a computer of the People's Daily in China.
Example two: http://www.rol.cn.net/talk/talk1.htm
Its computer domain name is www.rol.cn.net. The hypertext file (the file type is. html) is the talk1.htm under the directory/talk. This is the address of the chat room, which can enter the 1th room of the chat room.

Differences and connections between URIs, URLs, and urns
Uri:uniform Resource Identifier, Uniform Resource Identifier;
Url:uniform Resource Locator, Uniform Resource Locator;
Urn:uniform Resource name, Uniform resource names.
Where Url,urn is a subset of URIs.
The basic form of an address on the web is a URI, which represents the Uniform Resource identifier. There are two kinds of forms:
URL: The most common form of URIs today is ubiquitous URLs or uniform resource locators.
An updated form of Urn:url, the Uniform Resource name (URN, Uniform Resource name) is not dependent on the location, and it is possible to reduce the number of failed connections. But its popularity will take time, because it requires more sophisticated software support.
A URI is a simple string that identifies a resource in a uniform (standardized) way.
URIs are generally made up of three parts:
1. Access the resource naming mechanism.
2. Host name of the resource to be stored.
3. The name of the resource itself, represented by the path.
Typically, this string begins with the scheme (the identifier of the namespace that names the URI-a set of related names), with the following syntax:
[Scheme:] Scheme-specific-part
The URI begins with a scheme and a colon. Scheme starts with uppercase/lowercase letters, followed by empty or followed by more uppercase/lowercase letters, numbers, plus signs, minus and dot numbers. The colon separates scheme from Scheme-specific-part, and the syntax and semantics of scheme-specific-part (meaning) are determined by the namespace of the URI. As in the following example:
Http://www.cnn.com, where HTTP is scheme,//www.cnn.com is Scheme-specific-part, and its scheme is separated from Scheme-specific-part by a colon.
URIs have absolute and relative points, and absolute URIs refer to the URIs that begin with scheme (followed by a colon). The http://www.cnn.com mentioned above is an example of an absolute URI, and other examples are mailto:[email protected], news:comp.lang.java.help, and Xyz://whatever. You can think of an absolute URI as referencing a resource in a way that is not dependent on the environment in which the identifier appears. If you use the file system as an analogy, an absolute URI is similar to the path of a file starting from the root directory.
Unlike an absolute URI, a relative URI is not a URI that begins with scheme (followed by a colon). An example of this is articles/articles.html. You can think of a relative URI as referencing a resource in a way that relies on the environment in which the identifier appears. If the file system is used as an analogy, the relative URI is similar to the file path starting from the current directory.
The URL is the abbreviation for uniform resourcelocation, translated as "Uniform Resource Locator." In layman's words, URLs are strings used on the Internet to describe information resources, mainly used in various WWW client programs and server programs, especially the famous mosaic. URLs can be used in a unified format to describe various information resources, including files, server addresses and directories.
The format of the URL consists of the following three parts:
The first part is the agreement (or service mode);
The second part is the host IP address (and sometimes the port number) where the resource is stored;
The third part is the specific address of the host resource. , such as directory and file name.
The first and second sections are separated by a "://" Symbol, and the second and third sections are separated by a "/" symbol. The first part and the second part are indispensable, and the third part can be omitted sometimes.
At present, the biggest disadvantage is that when the information resource storage location changes, the URL must be changed accordingly. So people are looking at new ways to represent information resources, such as: URIs (Universal Resource Identifier), which are "Common resource Identifiers" (see RFC 1630), URN (uniformresource name), and Uniform Resource name and URC (Uniform Resource citation) are "Uniform resource references" and so on.
The URI is still in the midst of further research. The direction of research is to make up for the current shortcomings of URLs.

----------------------------------------------
The simple understanding is that the URL is the gate, the URI is the door of each room.

Url:
URL is uniform Resource location abbreviation, since the landlord know I will not wordy

A URI is a general scenario for locating resources on the Internet, and its focus is on resources, not location. In theory, URIs can find the most recent copy of a mirrored document, or locate a document that moves from one site to another.

URIs are every resource available on the Web-HTML documents, images, video clips, programs, and so on-positioned by a generic resource identifier (Universal Resource Identifier, referred to as the "URI").
URIs are generally made up of three parts:
1. Access the resource naming mechanism.
2. Host name of the resource to be stored.
3. The name of the resource itself, represented by the path.
Note: Most people may be familiar with "URLs" rather than URIs. A URL is a subset of the URI naming mechanism.

The difference is that the URI defines the resource, and the URL not only defines the resource, but also defines how to find the resource. For example, on a server, the absolute address (absolute path) to a folder/Web page is the URI.
Reference: http://baike.baidu.com/view/160675.htm

The difference between a URI and a URL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.