What is a URL?
A URL (Uniform Resource Locator) is a unique identifier used to locate a resource on the Internet. It is also referred to as a web address. URLs consist of multiple parts — including a protocol and domain name — that tell a web browser how and where to retrieve a resource.
End users use URLs by typing them directly into the address bar of a browser or by clicking a hyperlink found on a webpage, bookmark list, in an email or from another application.
Syntax of a URL:
scheme://prefix.domain:port/path/filename
Here,
- scheme is used to define the type of Internet service (most common is http or https).
- prefix is used to define a domain prefix (default for http is www).
- domain is used to define the Internet domain name (like javaTpoint.com).
- port is used to define the port number at the host (default for http is 80).
- path is used to define a path at the server (If omitted: the root directory of the site).
- filename is used to define the name of a document or resource.
Following is a list of some common types of schemes used in URL:
- http(HyperText Transfer Protocol):Common web pages. Not 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 only be sent over the Internet using the character set. If a URL contains characters outside the ASCII set, the URL has to be converted.
URL encoding converts non-ASCII characters into a format that can be transmitted over the Internet.
URL encoding replaces non-ASCII characters with a “%” followed by hexadecimal digits.
URLs cannot contain spaces. URL encoding normally replaces a space with a plus (+) sign, or %20.
ASCII Encoding Examples
Your browser will encode input, according to the character-set used in your page.
The default character-set in HTML5 is UTF-8.
Character | From Windows-1252 | From UTF-8 |
---|---|---|
€ | %80 | %E2%82%AC |
£ | %A3 | %C2%A3 |
© | %A9 | %C2%A9 |
® | %AE | %C2%AE |
À | %C0 | %C3%80 |
Á | %C1 | %C3%81 |
 | %C2 | %C3%82 |
à | %C3 | %C3%83 |
Ä | %C4 | %C3%84 |
Å | %C5 | %C3%85 |