HTML Uniform Resource Locators
A Uniform Resource Locator (URL), also called a web address, is a reference to a web resource. Read and learn more about URL, its syntax, and encoding.
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 retrieving it. A URL is a special type of Uniform Resource Identifier (URI), although sometimes these two terms are used interchangeably. In most 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 because they are easier to remember than numbers.
The syntax of a full Web address is the following:
The syntax of the HTML URL
scheme://domain:port/path/filename?query#fragmentExplanation:
| scheme | Specifies the type of Internet service. http/https is the most common. |
|---|---|
| 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. |
| query | Specifies query parameters for the resource. |
| fragment | Specifies a fragment identifier (anchor) within the resource. |
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
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.
Practice
What are the components of a URL?