URL Protocol Substrings
The URL substrings are separated by special characters as follows: The protocol substring defines a network protocol for accessing a resource. These strings are short names followed by the three characters ://. Typical URL protocols include HTTP (http://), FTP (ftp://), and email (mailto://).
URL Host Substrings
The host substring identifies a destination computer or other network device. Hosts source from standard internet databases such as DNS and can be names or IP addresses. The hostnames of many websites refer not only to a single computer but rather to groups of servers.
URL Location Substrings
The location substring contains a path to one specific network resource on a host. Resources are normally located in a host directory or folder. For example, a website may have a resource like /2016/September/word-of-the-day-04.htm to organize content by dates. When the location element is an empty shortcut, as in the URL http://example.com, the URL conventionally points to the root directory of the host (denoted by a single forward slash) and often a home page (like index.htm).
Absolute and Relative URLs
Full URLs featuring all three of the substrings are called absolute URLs. In some cases, URLs may specify only the one location element. These are called relative URLs. Relative URLs are used by web servers to avoid hard-coding location elements that may be subject to change. Following the above example, web pages on the same server that link to it can code a relative URL as:
It uses the relative URL instead of the equivalent absolute URL:
This takes advantage of the server’s assumption of the missing protocol and host information. Relative URLs only work when the host and protocol information is established.
URL Shortening
Standard URLs on modern sites tend to be long strings of text. Because sharing long URLs on Twitter and other social media sites is cumbersome, several companies built online translators that convert a full (absolute) URL into a shorter URL specifically for use on their social networks. Popular URL shorteners of this kind include t.co (used with Twitter) and lnkd.in (used with LinkedIn). Other URL shortening services like bit.ly and goo.gl work across the internet and not only with specific social media sites. In addition to offering an easier way to share links with others, some URL shortening services offer click statistics. A few also safeguard against malicious uses by checking the URL location against lists of suspicious domains.