URL is an acronym for Universal Resource Locator. It acts as an address of a resource on the Internet. An example of a URL you would have used is http://www.google.com. You probably found this article while searching on Google.
Parts of a URL
Let’s look at the URL in detail. The URL http://www.google.com is the address for the search engine hosted by Google. A URL has two main components which are separated by a colon, the protocol identifier and the resource name.
In the above example, HTTP is the protocol identifier, and www.google.com is the resource name.
The protocol identifier indicates which protocols are to be used to fetch the required resource. The above example uses HTTP, which stands for HyperText Transfer Protocol.
This protocol is used to serve hypertext documents (web pages). Other protocols include https, which is a secure version of HTTP, FTP (File Transfer Protocol), Email (mailto), Telnet, Gopher, News (Usenet), etc.
Resource name in a URL has several parts. Let’s slice and dice them.
In the example given above, www refers to World Wide Web also commonly known as the web. The web is a collection of resources that you can access using the Internet.
This is called the hostname. This is used to access a specific website. Each hostname is associated with an IP address. For accessing a website, the hostname is first translated to its IP address using a DNS server.
DNS stands for Domain Name System. DNS is like a phonebook record for the Internet. It maintains the directory of domain names which is used to translate them to an IP address.
Your Internet Service Provider (ISP) maintains a DNS server for this purpose. Google also has a DNS server that can be used free of cost.
The part of the URL located after the last dot is called top-level domain (TLD). They serve a way to understand what the website is about or what is the location of the registrant.
For example, .gov represents that the website is centred around government while .ca would indicate the website belongs to a Canadian organisation. Some examples of top-level domains include .net, .org, .co.uk, .in, .info, .edu, etc.
Hostname combined with the top level domain is called the Fully Qualified Domain Name (FQDN). An FQDN is also called ‘absolute domain name’ as it provides the absolute path of the host.
Additional Parts of a URL
In addition to the parts mentioned above, a URL may also contain a filename, a port number or a reference.
A filename represents where the file resides on the host machine. The filename is written after the domain separated by ‘/’.
The default port used for communication is 80. The port number is eliminated when the default port is in use. Another commonly used port is 8080.
The host can use a range of port numbers except a few which are reserved for a specific type of communication. Port number is added after the TLD separated by a colon (:).
This is used when you want to be directed to a specific part of the file.