The Application Layer & HTTP

a URL

/ you-are-EL /

A URL is the address you type into a browser, like https://example.com:443/photos/cat.jpg?size=large. It is the web's equivalent of a full postal address: it tells the browser exactly how to reach a particular resource and which one. Just as "42 Oak Street, Apt 3, Springfield" pins down one door out of millions, a URL pins down one specific thing out of everything on the web.

A URL is built from named parts in a fixed order. The scheme (https) says which protocol to use. The host (example.com) names the machine — the browser will turn this into an IP address via DNS. The optional port (:443) says which door on that machine; if omitted, the scheme's default is used (80 for http, 443 for https). The path (/photos/cat.jpg) names the specific resource on that server. An optional query string after a question mark (?size=large) carries parameters, written as name=value pairs joined by ampersands. An optional fragment after a hash (#section2) names a spot within the page and is handled by the browser, not sent to the server.

The point of a URL is uniform identification: one consistent format can name a page, an image, a video, an API endpoint, or a downloadable file, regardless of where it physically lives. This is what makes hyperlinks work — a link is just a URL, so any document can point at any resource anywhere. Note that a URL names a location (where to find something); it is one kind of the broader idea of a URI (an identifier). Because URLs are locations, they can break: if the resource moves, the old URL may return 404.

Break down https://shop.example.com/items/42?color=red#reviews — scheme: https; host: shop.example.com; port: 443 (the https default, not written); path: /items/42; query: color=red; fragment: reviews. The browser uses host+port to connect, sends "GET /items/42?color=red", and then scrolls to the "reviews" anchor itself.

scheme://host:port/path?query#fragment — only the host, port, path, and query reach the server; the fragment stays in the browser.

Spaces and many symbols cannot appear literally in a URL, so they are percent-encoded — a space becomes %20. A URL with %20 or %2F is not corrupted; it is just escaping characters that would otherwise confuse the parser.

Also called
Uniform Resource Locatorweb address網址統一資源定位符