All of us had came across lot of websites. Each website will have URL. First of all, What is URL? What is it used for? What does URL contains? What happens when you type an URL and hit search inany search engine? Let us know about each of these.
URL stands for Uniform Resource Locator. As the name specifies, it is used to locate the address of a website in World Wide Web. URL contains a lot of text in it alphabet, numbers etc. Usually we have five parts in a URL, they are Scheme Or Protocol, Sub domain, Top-level domain, Second-level domain and Subdirectory
Let us consider an example URL to demonstrate more clearly.
In the above URL the Protocol is http which stands for Hyper Text Transfer Protocol is the first part of URL. It specifies the protocol that the browser must use. There are many protocols such as ftp (File Transfer Protocol), the secured version of http that is https and mailto: etc.
The second part is Domain. In the above URL the portion from ‘www’ to’.com’ is the domain of the URL. The domain consists of three parts: Subdomain, Top-level domain, second-level domain. Top level domain is .com and the second level domain is the one that is directly below the top level domain. In our example it is exampleurl. Subdomain is a part of the URL that comes before domain name(exampleurl) and extension (.com). In our example it is www. You can learn more about World Wide Web(www) and it’s role in URL if you want to.
The next part is Subdirectory or Path. In our case it is example1. The path says where the browser should take us to in a particular website. In our example, browser takes to the on of the exampleurl websites page example1.
No we know the complete anatomy of a URL. Now, let us know the procedure by which we can see the webpage, by which browser returns us the well structured webpage. If we have to understand that then we should know about DNS, Server.
DNS stands for Domain Name System. Think ii as a phone book which maintains a phone number for each name. In the similar way, DNS maintains the IP address of each Domain. Every URL will have a unique IP Address. All these IP Addresses are maintained by DNS.
The definition of Server is well known to everyone. Server is a computer which provides data to another computer. There are many types of servers such as web server, mail server, file server.
We know that every web page is written in HTML and is stored with .html extension. Then are we able to see a structured web page which shows no code? Let us know now. Now, let us exactly know what happens when you type a URL and hit search.
- The browser sends the domain name to DNS
- The DNS returns the IP Address corresponding to that domain name
- The browser receives that IP Address, sends to the Server and asks the file that may be a html file or image or sound etc.
- The Server receives the request and sends back the requested file to the browser.
- The browser then converts the code in the file into a well structured document and then finally displayed to us. This conversion happens due to the presence is DOCTYPE in the code of that file. You will learn more about these in HTML.
We are very lucky because long time ago, there were no domain names, we have to know the IP Address of the page to access that. An IP Address is a set of integers. But now, it is very because the domains can be chosen by us according to our needs and can be accessed with out headache.