Examples of Great URL Design (2023)
Web developers trade examples of good and bad URL design, from Amazon product pages and Stack Overflow question links to Notion documents, GitHub commits, and news articles. Key themes include how to balance human-readable slugs with stable numeric IDs, handle renames and redirects without breaking links, support localization, and avoid misleading or abusive text in URLs. Many argue that clean, permanent, concise URLs still matter for usability, SEO, and long-term maintainability, even as browsers and link previews hide much of the address from end users.
Slug + ID vs. Slug-only Designs
- Many commenters like the “ID plus optional slug” pattern (e.g.,
/questions/:id/:slugor/dp/:id), because:- IDs give stable, permanent references.
- Slugs can change with titles without breaking links.
- Servers can ignore or 302-redirect if the slug is missing or wrong, avoiding misleading or obscene text.
- Others find slugs unnecessary bloat: URLs get long, break when titles change, and are often unreadable in non-ASCII languages.
- Some argue slug-only URLs are “more elegant” but require extra tables, many-to-one slug mappings, and redirects to avoid broken links or misleading slugs.
Amazon, Stack Overflow, Notion & Other Real-World Schemes
- Amazon’s
/slug/dp/idis seen as both good (human readable, SEO-friendly, ID works alone) and annoying (slug before ID makes trimming harder; URLs bloated with tracking parameters). - Stack Overflow’s
/questions/id/slugis praised as easy to shorten and canonicalize; they 301 to the correct slug. - Notion, Confluence, Reddit, and news sites commonly use
…/whatever-title-or-text-id, often ignoring the text and relying on the ID, with mixed feelings about prankable text and SEO motivations. - GitHub’s URLs are widely admired for consistency, REST-like structure, and extension-based variants (
.patch,.diff,.keys).
URL Semantics, Structure, and Rules
- Several participants endorse principles like:
- One resource ↔ one URL; URLs should be permanent, manageable, scalable, short, and optionally contain a “speaking” slug or namespace.
- File-like suffixes (
.json,.html) can be useful for APIs; opinions diverge on exposing server-side tech extensions (.php,.aspx).
- Debate over trailing slashes and whether they matter; consensus leans toward “not important” if behavior is consistent.
Localization, Accessibility, and UX
- Some advocate localized slugs and language codes in paths (e.g.,
/en/,/cy/), arguing it respects non-English speakers and can help SEO. - Others say modern search and link previews reduce the importance of human-readable URLs, especially on phones.
- Link previews themselves are divisive: some find them space-wasting and low-value; others see them as replacing the role of descriptive slugs.
Edge Cases and Technical Concerns
- Discussions around encoding (
/,+,%20) highlight complexity when allowing arbitrary characters or open-ended path segments. - Canonical tags and 301 redirects are frequently mentioned as necessary to avoid duplicate content and analytics confusion.