Understanding URL Structure: A Complete Guide

Understanding URL Structure: A Complete Guide

When browsing the internet, every website you visit is accessed through a URL (Uniform Resource Locator). But have you ever wondered what each part of a URL means? Let’s break it down with the help of an illustration and real-world examples.


📌 What is a URL?

A URL is simply the address of a resource on the internet. It tells your browser where to find a website, a file, or any online resource.

Here’s a breakdown of a sample URL:

https://www.example.com:80/file.html?key1=value1&key2=value2#00s0350qt


🔎 Components of a URL

1. Protocol (https://)

This defines how the browser should communicate with the server.

  • http:// → HyperText Transfer Protocol
  • https:// → Secure version of HTTP (encrypted)

➡️ Example: https://www.google.com


2. Subdomain (www)

Subdomains help organize and separate parts of a website.

  • www is the most common.
  • Other examples: blog.example.com, shop.example.com

➡️ Example: https://maps.google.com (subdomain: maps)


3. Domain Name (example.com)

This is the human-readable address of a website. It usually consists of:

  • Second-level domain: example
  • Top-level domain (TLD): .com, .org, .ke

➡️ Example: youtube.com


4. Port (:80)

Defines the gateway for communication.

  • Default for HTTP80
  • Default for HTTPS443

Most browsers hide default ports, but custom ones are visible.

➡️ Example: https://localhost:8080 (port 8080 is specified)


5. Path (/file.html)

Specifies the location of a file or resource on the server.

➡️ Example: https://www.nytimes.com/section/technology (Path: /section/technology)


6. Query Parameters (?key1=value1&key2=value2)

Used to pass data to the server. Often seen in search queries and dynamic pages.

  • Format: ?key=value
  • Multiple values separated by &

➡️ Example: https://www.google.com/search?q=nestict+infotech (Query parameter: q=nestict+infotech)

➡️ Example: https://www.amazon.com/s?k=laptops&ref=nb_sb_noss (Multiple parameters: k=laptops and ref=nb_sb_noss)


7. Fragment (#00s0350qt)

This points to a specific section of a page (also called an anchor).

➡️ Example: https://en.wikipedia.org/wiki/URL#Syntax (Fragment: #Syntax takes you directly to the "Syntax" section)


Read more