What is a URI and what is a URL? What is the relationship between the two?

Source: Internet
Author: User
Tags format ftp include gopher url example ftp access access port number

  1. What is a URI

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, "URI").

A URI generally consists of three parts:

    1. The naming mechanism for accessing resources.
    2. Host name where the resource is stored.
    3. The name of the resource itself, represented by the path.

Consider the following URI, which represents the current HTML 4.0 specification:

  Http://soft.webjx.com/lesson/148/2623648.shtml

This URI is this: this is a resource that can be accessed through the HTTP protocol, located in the main

On the machine soft.webjx.com, through the path "/lesson/148/" access. Other resources in the HTML document include "mailto" (email) and "FTP" (FTP access).

This is another example of a URI that points to a user's mailbox:

<a href=mailto:web@webjx.com> to Webmaster </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 "#" and follows a anchor flag

Character (called a fragment marker). For example, the following 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 an upper-level path, and may also contain fragment markers.

To illustrate the relative URI, suppose we have a basic URI http://www.acme.com/support/intro.htm

The relative URI is used in the following links:

<a href= "104/2627604.shtml" > website tao </A>

It expands into a complete URI that is "http://homepage.webjx.com/104/2627604.shtml".

The following is the relative URI of an image:


It expands into a full URI that is "http://www.webjx.com/TLimages/img/head/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 script elements).
    • Include images, objects, or applets within the page (see Imag, Object, applet, and input elements).
    • 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 Resource location, translated as "Uniform Resource Locator." In layman's parlance, URLs are the strings used to describe information resources on the Internet, mainly used in various WWW client programs and server programs, especially the famous mosaic. URL can be used in a uniform format to describe a variety of information resources, including files, server addresses and directories.

  The format of the URL

The format of the URL consists of the following three parts:

    1. The first part is the agreement (or service mode);
    2. The second part is the host IP address (sometimes including the port number) that contains the resource;
    3. The third part is the specific address of the host resource. , such as directories and filenames.

The first part and the second part are separated by the "://" Symbol, and the second and third parts are separated by the "/" symbol. The first part and the second part are indispensable, and the third part can be omitted sometimes.

  URL Example

URL of File:

When a file is represented by a URL, the server is represented by file, followed by the host IP address, the file's access path (that is, the directory), and the filename. Sometimes the directory and file names can be omitted, but the "/" symbol cannot be omitted.

Example one: File://ftp.webjx.com/soft/file/robots.txt

Represents a file in the soft/file/directory on the host ftp.webjx.com, and the file name is robots.txt.

Case two: File://ftp.webjx.com/pub

Represents the directory/pub on the host ftp.webjx.com.

Example three: file://ftp.webjx.com/

Represents the root directory on the host ftp.webjx.com.

  Gopher URL:

The gopher server may use a special port, in which case the host IP address is separated from the port:

Example one: gopher://gopher.webjx.com/

Represents a gopher server on a host gopher.webjx.com.

Case two: gopher://gopher.webjx.com:1234

Represents the gopher server on the host gopher.webjx.com, on port 1234.

  URL of the network news:

When using a URL to represent a network newsgroup, if it is Usenet, just specify the name of the newsgroup.

For example: news:rec.gardening

Represents the rec.gardening newsgroup (horticulture) on Usenet.

  URL for http:

Use the Hypertext Transfer Protocol HTTP to provide resources for hypertext information Services.

Example one:http://homepage.webjx.com/175/2603675.shtml

Its computer domain name is homepage.webjx.com. The super text file (the file type. shtml) is 2603675.shtml under directory/175. This is a computer in Tenkine.



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.