URL
A URL identifies a resource through a structured address whose components determine how browsers resolve and request it.
Download Markdown (.md)Soroush’s Product Wiki · https://wiki.soroush.uk/topic/url/
01What it means
A Uniform Resource Locator, or URL, is a resource identifier interpreted according to a scheme. A typical web URL contains a scheme, host, optional port, path, query, and fragment. Relative references resolve against a base URL. For HTTP requests, the fragment is handled by the client rather than sent as part of the request target.[1][2]
02Why it matters
URL structure affects linking, navigation, caching, sharing, and integration behavior. Confusing a host with a path or constructing addresses by raw concatenation can send users to the wrong resource or change a request’s meaning.
03When to use it
Use this model when designing links, callbacks, deep links, and resource addresses. Use platform URL parsers and encoding utilities. A syntactically valid address is not proof that its destination is safe, reachable, or authorized.
04How it works
- Identify the scheme and the components meaningful to the workflow.
- Resolve relative references against the intended base.
- Construct and encode path and query values with suitable URL APIs.
- Validate allowed destinations and schemes when user input influences navigation.
- Test spaces, non-ASCII values, fragments, and redirects with realistic examples.
05A practical example
A search page links to a query containing an ampersand in a hotel name. Raw concatenation splits the name into separate parameters. The team uses a query-parameter API so the shared URL preserves the intended search value.
06Where it breaks
URL syntax and normalization have edge cases, and scheme behavior differs. Addresses may expose sensitive data through logs or browsing history. A stable address also requires routing and redirect policies beyond merely choosing a readable path.
Common mistakes
- Encoding an entire URL as though it were one query value.
- Expecting the server to receive the fragment automatically.
- Treating a domain-name substring as a reliable destination check.
07Sources
- URL StandardWHATWG · Living standardURL Standard
- What is a URL?MDN Web Docs · Official documentationWhat is a URL?