HTML Uniform Resource Locators

URL is a web address.

The URL can consist of letters, such as “runoob.com”, or an Internet Protocol (IP) address: 192.68.20.50. Most people access the website using the website domain name, because the name is easier to remember than the number.

URL-Uniform Resource Locator

The web browser requests the page from the web server through the URL.

When you click on a link in an HTML page, the corresponding <a> tag points to an address on the World Wide Web.

A Uniform Resource Locator (URL) is used to locate documents on the World Wide Web.

An example of a web page address: http://hackerthink.com/html/html-tutorial.html Grammar rules:

scheme://host.domain:port/path/filename

Description:

  • scheme-defines the type of Internet service. The most common type is http
  • host-defines the domain host (the default host for http is www)
  • domain-defines the Internet domain name, such as runoob.com
  • :port-defines the port number on the host (the default port number for http is 80)
  • path-defines the path on the server (if omitted, the document must be located in the root directory of the website).
  • filename-defines the name of the document/resource

Common URL Scheme

Here are some URL schemes:

Scheme access Used for…
http Hypertext Transfer Protocol Normal web pages beginning with http://. No encryption.
https Secure Hypertext Transfer Protocol Secure web pages, encrypt all information exchange.
ftp File transfer protocol Used to download or upload files to a website.
file   Files on your computer.

URL character encoding

URL can only use ASCII character set .

To send over the Internet. Since URLs often contain characters outside the ASCII set, URLs must be converted to a valid ASCII format.

URL encoding uses “%” followed by a two-digit hexadecimal number to replace non-ASCII characters.

The URL cannot contain spaces. URL encoding usually uses + to replace spaces.

Online examples

If you click the “Submit” button below, the browser will URL encode the input before sending it. The page on the server will display the received input.


Try to enter some characters, then click the submit button again.

URL encoding example

Character

URL Encoding

%80
£ %A3
© %A9
® %AE
À %C0
Á %C1
 %C2
à %C3
Ä %C4
Å %C5

For a complete URL encoding reference, please visit our URL encoding reference manual .