Learn everything about JavaScript & supporting libraries/frameworks

URLs: A Simple Guide

All Articles New Article

Breaking Down URLs: A Simple Guide

Imagine that you want to send a letter to your friend.

You need to know their address, right?

The address tells you where to send the letter.

A URL is like the address of a website. It tells your computer where to find the website.

Example URL -

*𝗵𝘁𝘁𝗽𝘀://𝗯𝗹𝗼𝗴.𝗲𝘅𝗮𝗺𝗽𝗹𝗲.𝗰𝗼𝗺:𝟴𝟬/𝗳𝗶𝗹𝗲.𝗵𝘁𝗺𝗹?𝗸𝗲𝘆𝟭-𝘃𝗮𝗹𝘂𝗲&𝗸𝗲𝘆𝟮-𝘃𝗮𝗹𝘂𝗲# 𝟬𝟬𝘀𝟬𝟯𝟱𝟬𝗾

Now, let's break down this URL into its different parts:

𝗵𝘁𝘁𝗽𝘀:// : This is the protocol - it's like the method of transportation. In the real world, it could be a car, a bike, or a walking.

On the internet, it tells your computer how to talk to the website's computer.

The most common ones are HTTP and HTTPS (which is just HTTP but more secure, like a car with seatbelts and airbags).

𝘄𝘄𝘄.𝗲𝘅𝗮𝗺𝗽𝗹𝗲.𝗰𝗼𝗺 : This is the domain name.

It's the specific house address. 'example.com' is like saying "123 Main Street" and 'www' is

specifying that you're going to the main entrance, not the back door.

𝗯𝗹𝗼𝗴.𝗲𝘅𝗮𝗺𝗽𝗹𝗲.𝗰𝗼𝗺 : In our domain name, 'example.com' is like the street address "123 Main Street". But now we have 'blog' at the beginning - this is a subdomain.

Think of the subdomain as a specific building on the property.

So, 'blog' might be like the guest house in the backyard. When we add 'blog' before 'example.com', we're saying, "Don't go to the main house - go to the guest house."

𝗳𝗶𝗹𝗲.𝗵𝘁𝗺𝗹 : This is the path. It's like the directions to a specific room within the house. For example, to find the kitchen, you might go through the hall and turn left.

𝗸𝗲𝘆𝟭-𝘃𝗮𝗹𝘂𝗲&𝗸𝗲𝘆𝟮-𝘃𝗮𝗹𝘂𝗲 : This is the query string. It's like adding more specific instructions or requests. Imagine you're going to the kitchen to get a specific type of cookie. The query is your way of specifying exactly what you want - chocolate chip, oatmeal raisin, etc.

𝟬𝟬𝘀𝟬𝟯𝟱𝟬𝗾: This is the fragment or anchor. It's like a specific spot in a room. If the room is a webpage, the fragment might be a particular line of text or image on that page.

So, putting it all together, a URL is like telling your computer:

"Take the HTTPS car to the property at '𝗲𝘅𝗮𝗺𝗽𝗹𝗲.𝗰𝗼𝗺'. But don't go to the main house - go to the '𝗯𝗹𝗼𝗴' guest house. Then, inside that house, find the '𝗳𝗶𝗹𝗲.𝗵𝘁𝗺𝗹 ' room. Look for the specific '𝗸𝗲𝘆𝟭-𝘃𝗮𝗹𝘂𝗲&𝗸𝗲𝘆𝟮-𝘃𝗮𝗹𝘂𝗲' thing I want. And then go straight to the '# 𝟬𝟬𝘀𝟬𝟯𝟱𝟬𝗾' spot on that thing."

Remember, just like a real-world address, each part of a URL helps our computer find exactly what we're looking for on the vast property of the internet!

All Articles New Article
Learn everything about JavaScript & supporting libraries/frameworks