Topic
URLs
A URL is a structured identifier that tells software how to locate or address a resource using a particular scheme and set of components.
At a glance
- Common web schemes
- https and http
- Optional components
- Port, query, and fragment
Overview
URLs appear throughout the web as addresses for pages, images, APIs, downloads, and other resources. A URL can include a scheme, host, port, path, query, and fragment, although not every component is present every time. Software parses those components according to defined URL rules rather than treating the whole address as an arbitrary string.
The components have distinct roles
The scheme selects a protocol or processing model, the host identifies the network destination, the path selects a resource within that context, and the query can carry additional parameters. A fragment is processed on the client side and is not part of the HTTP request target sent to the server in the usual web flow.
Parsing beats string guessing
Application code should use a standards-aware URL parser when accepting or transforming addresses. Manual substring checks can misread encoded characters, unusual ports, credentials, or lookalike hostnames and can create security problems when a URL controls navigation or server-side fetching.
Sources and review
MOOR's explanatory text is supported by the following source links.
- What is a URL? — MDN Web Docs
- URL Standard — WHATWG