Track 01 · Lesson 1 of 9How the web works
Anatomy of a URL
Lesson 1 of 9· 6 min
Every web address is a short set of instructions: how to talk to the server, which server, which door to knock on, which page you want, and a few extra details. Learn to read one and you'll spot a phishing link in a second.
Take a URL apart
Type your own, or try a preset
Every web address has parts. Type your own, or click a part.
Domain name
The registered name, rented from a registrar. Together with the top-level domain it tells you who really owns the site, so it's the part to check before typing a password.
Origin: https://shop.example.com:8443. Scheme, host and port together. Browsers use it for the same-origin policy and CORS.
Read the host from the right#
The part that tells you who owns a site is the domain name plus the top-level domain: example.com, github.com, bbc.co.uk. Someone registered it and pays for it. Everything to its left is a subdomain, and the owner can make up as many as they like.
That's the whole trick behind most phishing links. In example.com.account-verify.io, the words example.com sit on the left, where anyone can type anything. Read from the right and the real owner is account-verify.io.
The origin#
Three parts together, scheme, host and port, make up a page's origin: https://shop.example.com:8443. When the port is missing, it's implied: 443 for https, 80 for http.
Browsers use the origin to keep sites apart. A script from one origin can't read another origin's data without permission. You'll meet this again in the next lessons on cookies, and properly in Attacks and defenses with the same-origin policy and CORS.
What reaches the server, and what doesn't#
- The path and query string are sent to the server, and they end up in browser history, server logs and analytics tools. Never put passwords or tokens in them.
- The fragment, the part after
#, never leaves the browser. It only points to a spot on the page.
Check yourself