Definitions and relationships between Uris and URLs

Source: Internet
Author: User
Tags file url gopher url example ftp access
1. What is uri?

Every type of resources available on the web-HTML documents, images, video clips,ProgramAnd so on.

A URI consists of three parts:

    1. The naming mechanism for accessing resources.
    2. Host Name for storing resources.
    3. The name of the resource, represented by the path.

Consider the following Uri, which indicates the current HTML 4.0 specification:

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

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

On the machine soft.webjx.com, access through the path "/lesson/148. Other Resources in the HTML document include "mailto" (sending and receiving emails) and "ftp" (ftp access ).

This is another example of Uri, pointing to a user's mailbox:

<A href = mailto: web@webjx.com> to webmaster </a>

Note: Most readers may be familiar with "url" instead of Uri. URL is a subset of the Rui naming mechanism.

Fragment identifier

Some Uris point to the interior of a resource. This URI ends with "#" And follows an anchor sign.

Identifier (called a fragment identifier ). For example, the following is a URI pointing to section_2:

Http://somesite.com/html/top.htm#section_2

Relative URI

The relative URI does not contain any naming rules. The path usually refers to the resources on the same machine. Phase

The URI may contain relative paths (for example, "..." indicates the path of the previous layer) and fragment identifier.

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

The following link uses the relative URI:

<A href = "104/2627604. shtml"> Web Tao Ba </a>

It expands to the full URI is "http://homepage.webjx.com/104/2627604.shtml ".

Below is the relative URI of an image:

It expands to the full URI is "http://www.webjx.com/TLimages/img/head/logo.gif ".

In HTML, Uri is used:

    • Link to another document or resource (see the and link elements ).
    • Link to an external style sheet or script (see link and script elements ).
    • The page contains images, objects, or applets (see imag, object, applet, and input ).
    • Create Image ing (see map and area ).
    • Submit a form (See Form ).
    • Create a framework document (see the frame and IFRAME elements ).
    • Reference an external reference (see Q, BLOCKQUOTE, INS, and del ).
    • Point to the metadata of a description document (see the head element ).

2. What is URL:

URL is the abbreviation of uniform resource location ". Generally speaking, URL is a string used to describe information resources on the Internet. It is mainly used in various WWW client programs and server programs, especially the famous mosaic. URL can be used to describe various information resources in a unified format, including files, server addresses and directories.

URL format

The URL format consists of the following three parts:

    1. The first part is the protocol (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 file names.

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

File URL:

When a file is expressed as a URL, the server uses file to indicate the Host IP address, the file access path (I .e. the Directory), and the file name. Sometimes the Directory and file name can be omitted, but the "/" symbol cannot be omitted.

Example 1: file: // ftp.webjx.com/soft/file/robots.txt

Represents a file in the soft/file/directory of the ftp.webjx.com host. The file name is robots.txt.

Example 2: file: // ftp.webjx.com/pub

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

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

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

Gopher URL:

The Gopher server may use special ports. In this case, the host IP address and port must be separated.

Example 1: gopher: // gopher.webjx.com/

Indicates the Gopher server on the host gopher.webjx.com.

Example 2: gopher: // gopher.webjx.com: 1234

Indicates the Gopher server on the host gopher.webjx.com, on port 1234.

URL of network news:

When a URL is used to represent a network newsgroup, if it is USENET, you only need to specify the name of the newsgroup.

Example: News: REC. Gardening

Indicates the rec. Gardening newsgroup (gardening) on Usenet ).

Http url:

The super text transmission protocol HTTP is used to provide resources for the Super Text Information Service.

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

The computer domain name is homepage.webjx.com. The super Startup File (the file size is .shtml) is 2601_5.shtml under the directory/175. This is a computer of Skynet.

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.