Anatomy of a URL
You'll learn how to identify and understand the different parts that make up a complete web address.
What Is a URL?
A URL (Uniform Resource Locator) is like a complete street address for a resource on the internet. Just as a postal address has components like street, city, and zip code, a URL has distinct parts that tell the browser exactly where to go and what to retrieve.
The Components
Consider this URL:
https://example.com:443/products/shoes?size=10&color=blue#reviews
Let's break it down:
Protocol
https:// — The "language" or method used to communicate. Common protocols are http and https (secure).
Host
example.com — The domain name or IP address of the server, like the city and street name in a postal address.
Port
:443 — The specific "door" on the server. Usually hidden (defaults: 80 for HTTP, 443 for HTTPS).
Pathname
/products/shoes — The specific path to the resource on the server, like navigating folders on your computer.
Search (Query String)
?size=10&color=blue — Parameters passed to the server, starting with ? and separated by &. These are like filling out a form's options.
Hash (Fragment)
#reviews — Points to a specific section within the page. The browser jumps there after loading.
Why This Matters
Understanding URL anatomy helps you work with navigation, form submissions, and API requests. You'll recognize which part controls what when debugging or building links.
Key Takeaway: A URL has six main parts—protocol, host, port, pathname, search, and hash—each serving a specific purpose in locating and displaying web resources.