HTML URL
On this page
HTML Uniform Resource Locators
A Uniform Resource Locator (URL), which is commonly called a web address, is a reference to a web resource specifying its location on the computer network and a mechanism for restoring it. A URL is a special type of Uniform Resource Identifier (URI), although sometimes these two terms are used interchangeably. In the majority web browsers, the URL of a web page is displayed above the page in an address bar.
A URL can be composed of words or an Internet Protocol (IP) address. Generally, users enter the name as they are easier to remember than numbers.
The syntax of a full Web address is the following:
scheme://prefix.domain:port/path/filename
Explanation:
类目 | 类目 |
---|---|
scheme | Specifies the type of Internet service. http/https is the most common. |
prefix | Specifies a domain prefix. www is the default for http. |
domain | Specifies the name of the Internet domain. |
port | Specifies the port number at the host. 80 is the default for http. |
path | Specifies a path at the server. If it is omitted, the resource will be located at the root directory. |
filename | Specifies the name of a resource or document. |
In HTML, a URL can have a partial form which is often called a relative URL. To create a full URL, a browser fills in missing parts of the URL from the relevant parts of the URL of the current page.
The following table lists some common schemes:
Scheme | Used for |
---|---|
http (HyperText Transfer Protocol) | Common web pages (non encrypted). |
https (Secure HyperText Transfer Protocol) | Secure web pages (encrypted). |
ftp (File Transfer Protocol) | Downloading or uploading files. |
file | A file on your computer. |
URL Encoding
URL Encoding
URLs can be transmitted over the Internet only using the ASCII character set. If a URL has characters outside the ASCII set, the URL must be converted.
Non-ASCII characters are replaced with a “%”, which is followed by hexadecimal digits.
URLs cannot contain spaces. URL encoding commonly replaces a space with %20, or a plus (+) sign.