0
0
Intro to Computingfundamentals~6 mins

URLs and their structure in Intro to Computing - Full Explanation

Choose your learning style9 modes available
Introduction
Imagine you want to visit a friend's house but you only know their name. You need a clear address to find the exact location. The internet works the same way: to visit a website, you need a clear address called a URL that tells your computer where to go.
Explanation
Scheme
The scheme is the first part of a URL and tells your computer how to access the resource. Common schemes include 'http' and 'https', which are used to visit web pages securely or not. It acts like the mode of transportation to reach the destination.
The scheme defines the method used to access the resource on the internet.
Host
The host is the main address of the website, like the name of a building or house. It usually looks like 'www.example.com' and tells your computer which server to connect to. This is the key part that directs your request to the right place.
The host specifies the exact server where the resource lives.
Port
The port is a number that tells your computer which door to use when entering the server. Most URLs leave this out because the computer uses a default door based on the scheme, like door 80 for 'http' or 443 for 'https'. It helps the server know which service you want.
The port directs the request to a specific service on the server.
Path
The path is like the street and apartment number inside the building. It tells the server exactly which page or file you want to see. For example, '/about' might take you to the About Us page of a website.
The path locates the specific resource within the server.
Query
The query is extra information added to the URL after a question mark '?'. It often contains details like search terms or filters, helping the server customize the response. For example, '?search=books' tells the server you want to search for books.
The query passes additional instructions or data to the server.
Fragment
The fragment comes after a '#' symbol and points to a specific part of the page, like a chapter in a book. It helps your browser jump directly to that section without reloading the whole page.
The fragment directs the browser to a specific section within the page.
Real World Analogy

Think of a URL as a full mailing address. The scheme is the type of delivery like mail or courier, the host is the city or building, the port is the specific entrance door, the path is the street and house number, the query is extra instructions like 'leave at the back door', and the fragment is the room number inside the house.

Scheme → Type of delivery service (mail, courier)
Host → City or building name
Port → Specific entrance door number
Path → Street and house number
Query → Extra delivery instructions
Fragment → Room number inside the house
Diagram
Diagram
┌─────────┬───────────────┬───────┬───────────────┬───────────────┬───────────┐
│ Scheme  │     Host      │ Port  │     Path      │    Query      │ Fragment  │
├─────────┼───────────────┼───────┼───────────────┼───────────────┼───────────┤
│ https   │ www.example.com │ :443  │ /about/us     │ ?id=123&ref=4#section2 │
└─────────┴───────────────┴───────┴───────────────┴───────────────┴───────────┘
This diagram shows the main parts of a URL arranged in order from scheme to fragment.
Key Facts
URLA URL is the full address used to find a resource on the internet.
SchemeThe scheme specifies how to access the resource, like http or https.
HostThe host is the domain name or IP address of the server hosting the resource.
PathThe path points to the specific location or file on the server.
QueryThe query provides extra parameters to customize the request.
FragmentThe fragment directs the browser to a specific part of the page.
Common Confusions
Believing the port is always visible in URLs.
Believing the port is always visible in URLs. Ports are often hidden because browsers use default ports for common schemes like 80 for http and 443 for https.
Thinking the fragment is sent to the server.
Thinking the fragment is sent to the server. The fragment is handled only by the browser and is not sent to the server.
Assuming the query is part of the path.
Assuming the query is part of the path. The query is separate from the path and starts after a '?' symbol to pass extra data.
Summary
A URL is like a full address that tells your computer exactly where and how to find something on the internet.
It has several parts: scheme (how to connect), host (where to go), port (which door), path (which room), query (extra info), and fragment (specific section).
Understanding each part helps you read and use URLs better, making internet navigation clearer.