{"canonical_url":"https://engineer.company/glossary/url/","content_markdown":"# URL\n\n## What it is\n\nA URL, short for Uniform Resource Locator and called a web address or simply a\nlink in everyday speech, is a line of text that both names a resource and\ntells software how to fetch it: which protocol to speak, which machine to ask\nand what to ask that machine for. Paste one into a browser, a terminal or a\nconfig file and each of them can act on it without further help.\n\nIts anatomy is fixed by the generic syntax every scheme shares:\n\n```text\nhttps://shop.example.com:8443/orders/42?view=full#items\n\nscheme     https\nhost       shop.example.com\nport       8443\npath       /orders/42\nquery      view=full\nfragment   items\n```\n\nThe scheme says how to reach the thing, here HTTP over TLS. The host and\noptional port say where, the path says which resource on that host, and the\nquery carries parameters, usually as `name=value` pairs joined by `\u0026`. The\nfragment after `#` points inside the result, at a heading or a position. It\nbelongs to the client: the browser leaves it out of the HTTP request target.\nThat does not make it secret from the server, because client-side code can read\nit and explicitly send it in another request.\n\nBecause characters such as `/`, `?`, `#`, `\u0026` and `=` have jobs in that\nstructure, data that would conflict with a delimiter in the component being\nbuilt has to be percent-encoded: written as `%` followed by two hexadecimal\ndigits. Which characters need that treatment depends on the component and its\nsyntax. A space becomes `%20`, an ampersand inside a query parameter value\n`%26`, and the percent sign itself `%25`. Letters outside ASCII travel the\nsame way, as their UTF-8 bytes, which is how Danish or Ukrainian words in a path\nget through.\n\nIs a URL the same as a URI? Nearly. A URI, a Uniform Resource Identifier, is\nany string in that syntax that identifies something; a URL is the kind that\nalso says how to locate it, while `urn:isbn:9780000000002` names a book and\ngives no way to fetch it. RFC 3986 asks new specifications to say URI. The\nWHATWG URL Standard, which browsers follow, went the other way: it settled on\nURL as the one word and set out to describe what real implementations do,\naiming to replace the RFC. The two agree on ordinary addresses and differ on\nedge cases, which is worth remembering when a browser and a server library\nparse the same odd string.\n\n## Why it matters\n\nA published URL is a promise. It ends up in bookmarks, search indexes, emails,\nprinted brochures, chat logs and other people's pages, and none of those copies\nupdate themselves. Changing the address later breaks every one of them unless\nthe old address keeps answering with a redirect to the new one.\n\nThat makes the useful decision an early one: what the address is built from.\nAnything that is likely to change is a poor foundation, whether a page title,\na category tree, a product name or a file extension that reveals the current\nframework. A short identifier, or a slug stored as data and edited on purpose,\nlasts. So does a plan for what happens when an address has to move anyway:\nthe old one becomes a permanent redirect rather than a 404.\n\nThe second decision is what stays out. RFC 9110 puts it bluntly: addresses are\nmade to be shared, not secured. They are written to server and proxy logs,\nkept in browser history, copied into analytics and, depending on policy, sent\nalong in the `Referer` header to whatever the page loads next. Session\nidentifiers, reset tokens, API keys and personal data belong in headers or\nrequest bodies.\n\nLength is a smaller question. The HTTP specification recommends that software\naccept addresses of at least 8,000 octets, which is generous, but a query\nstring carrying a whole form or a serialized filter tends to hit a shorter\nlimit somewhere along the chain before it reaches that.\n\n## What it looks like in practice\n\nThe work on this site treats addresses as data that outlives the text on the\npage. When\n[495 achievement pages across three languages were generated from a read-only SQLite export](/portfolio/generated-495-pages-from-a-sqlite-export/)\nat the documented August 2026 implementation stage, the most consequential\ndecision concerned the address. The site had derived a page's URL from the\nleading words of its English statement, so correcting a sentence silently\nmoved the page and broke every link to it. The address was then authored as\ndata, one row per address per achievement: the first row was the current one,\nand every later row was a retired address the site emitted as a redirect. The\nrecorded result was that every address published by that stage still answered.\n\nA note on mobile wallets shows what happens when one URL travels inside\nanother.\n[Phantom, Solflare and Backpack open a dApp through universal links](/notes/solana-mobile-wallet-deeplinks/)\nthat carry the target address in their own path and the requesting origin in a\n`ref` parameter, each passed through `encodeURIComponent`. An unencoded `?` or\n`\u0026` in the target corrupts the parse, and the wallet opens on its home screen\ninstead of the browser tab. A guessed custom scheme such as `backpack://` fares\nworse: the app registers no route that matches it, and the user lands on the\ninstall page.\n\nAddresses also serve as identity. When\n[963 structured-data blocks were replaced by one linked graph](/portfolio/replaced-963-metadata-blocks-with-one-graph/),\nthe identifiers for the organisation, the site and the person were minted from\nthe site's origin, and list pages publish their items by URL alone. At the documented July 2026 implementation stage, that choice\nwas measured: naming the items on the portfolio index would have meant 107 full\nstatements and a 52 per cent larger compressed page. The check guarding the\ngraph asserts that every URL it names was actually built.\n\n## Where it goes wrong\n\nURL bugs tend to be quiet. The address still looks right; it simply points\nsomewhere else, or reveals more than intended.\n\n**Encoding happens zero times or twice.** A return address dropped raw into a\nquery, as in `?next=/cart?item=4\u0026size=m`, splits at the unencoded `\u0026`, and the\nserver sees `size=m` as its own parameter. Encoding an already encoded string\nturns `%20` into `%2520`, and the page receives a literal `%20`. Encode each\ncomponent exactly once, at the moment it is placed into the address, with the\nfunction meant for components. In JavaScript that is `encodeURIComponent`;\n`encodeURI` leaves `?`, `\u0026` and `#` alone because it expects a whole address.\n\n**A secret rides in the query string.** A password-reset token or an API key in\nthe URL is copied into access logs, browser history and analytics, and under a\npermissive referrer policy it is sent in `Referer` to every third party the page\nloads from. Put credentials in a header. When a token has to travel in a link,\nas in a reset email, make it single-use and short-lived, and set a\n`Referrer-Policy` that keeps it at home.\n\n**One page answers at five addresses.** `http` and `https`, with and without\n`www`, with and without a trailing slash, `/About` and `/about`. The scheme and\nhost are case-insensitive by definition; the path is case-sensitive unless the\nserver decides otherwise. Search engines split the page's standing across the\ncopies, caches store each one separately and analytics count them apart. Pick\none form, redirect every other form to it permanently, and name it as canonical.\n\n**A relative link resolves against the wrong base.** A reference such as\n`img/logo.png` replaces everything after the last slash of the current path. On\n`/docs/guide` it resolves to `/docs/img/logo.png`; on `/docs/guide/` it\nresolves to `/docs/guide/img/logo.png`. One trailing slash moves every relative\nlink on the page. Root-relative links, starting with `/`, sidestep the problem.\n\n**Logic depends on the fragment.** Server-side redirects, access logs and\nanalytics that read the HTTP request target do not receive `#` or its fragment.\nA client can send it separately when the application needs it. Anything that has to\nreach the server as part of the initial request belongs in the path or the\nquery.\n\n## Further reading\n\n- [RFC 3986: Uniform Resource Identifier (URI): Generic Syntax](https://www.rfc-editor.org/rfc/rfc3986)\n  — the grammar, percent-encoding, relative resolution and normalisation.\n- [WHATWG URL Standard](https://url.spec.whatwg.org/) — the parsing algorithm\n  browsers implement, step by step.\n- [RFC 3987: Internationalized Resource Identifiers](https://www.rfc-editor.org/rfc/rfc3987)\n  — how addresses written in any script map onto percent-encoded bytes.\n- [RFC 8820: URI Design and Ownership](https://www.rfc-editor.org/rfc/rfc8820)\n  — why the owner of a host, and nobody else, decides how its paths look.\n- [RFC 9110, section 17.9](https://www.rfc-editor.org/rfc/rfc9110#section-17.9)\n  — the security note on sensitive information in addresses.\n\n\u003chttps://engineer.company/glossary/url/\u003e\n","date_modified":"2026-11-09T21:50:25Z","description":"The parts of a URL, how it differs from a URI, why an address is a promise worth keeping, and the encoding and duplicate-address traps.","formats":{"gemtext":"https://engineer.company/glossary/url/index.gmi","gopher":"https://engineer.company/glossary/url/gophermap","html":"https://engineer.company/glossary/url/","json":"https://engineer.company/glossary/url/index.json","markdown":"https://engineer.company/glossary/url/index.md","pdf":"https://engineer.company/glossary/url/index.pdf"},"kind":"page","language":"en","title":"What is a URL?","url":"https://engineer.company/glossary/url/","version":1}