URL and DNS explained!
Tags: beginners, url, browser
Published: 2021-10-10 15:37:00

## Introduction
Whenever you search for any resource(website, docs, images etc) on the internet, you can see their address in the address bar. This address tells us that the particular resource is hosted on that address server. The address is called URL and searching the server is done using DNS.

So in this article we are going to learn about *URL* and *DNS*. This article is an overview and i haven't got into too much details.


## 1) <u>URL</u>

**URL** stands for Uniform Resource Locator. URL is the address of the website which you can find in the address bar of your web browser. It is a reference to a resource on the internet, be it images, hypertext pages, audio/video files, etc.
For example: `https://www.google.com`

There are different parts of a URL, they are shown in the image below
![Alt text of image](https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Flh4.googleusercontent.com%2F-Lx69aIsa078%2FTXuNzpIGRbI%2FAAAAAAAAACw%2F95JWAs_yYsw%2Fs1600%2FURL.png&f=1&nofb=1)

### a) Scheme
The first part of the URL is the scheme, which indicates the protocol that the browser must use to request the resource (a protocol is a set method for exchanging or transferring data around a computer network). Usually for websites the protocol is HTTPS or HTTP (its unsecured version). 

### b) WWW(Sub-domain)

After protocol comes the famous WWW, it simply means that the resource you are seeking by the means of this URL resides in the WWW subdomain of your domain name.

### c) Domain name

Then the name of the resource owner (i.e. domain name) comes which is google in our example.

### d) Top-level domain

Domain name is followed by the type of category in which the owner domain is registered. *.com* means that the website which is making this resource available to you is of the commercial nature. There are a lot of other types of categories as well. For example, .org for organizational website, .edu for educational institutions, .gov for government websites.

### e) File Path

The path refers to the exact location of a page, post, file, or other asset. The path resides after the hostname and is separated by “/” (forward slash). The path/file also consists of any asset file extension, such as images (.jpg or .png, etc.), documents (.pdf or .docx), and more. 
But it is not compulsory that all URL will display the path.


## 2) <u>DNS</u>

**DNS** is short for Domain Name System. Like a phone-book, DNS maintains and maps the name of the website, i.e. URL, and particular IP address it links to. Every URL on the internet has a unique IP address which is of the computer which hosts the server of the website requested.

### How DNS works?

When you type a URL in the browser, the following steps take place:

- The browser checks for a DNS record to find the corresponding IP address of the website.
- Once the browser receives the correct IP address, it will build  a connection with the server that matches the IP address to transfer information.
- The browser sends an HTTP request to the server.
- The server handles the request and sends back a response.
- The browser displays the HTML content.

## Conclusion

I really hope that you enjoyed reading this article and learned something from it. If you have any doubt or you think i missed something let me know in the comments. Feel free to like and share the post. 
You can connect with me on:

Twitter:[Namit Malasi](https://twitter.com/namitmalasi)
LinkedIn:[Namit Malasi](https://www.linkedin.com/in/namit-malasi-a4b56310a/)
Github: [Namit Malasi](https://github.com/namitmalasi)