return to table of content

Examples of Great URL Design (2023)

ttepasse
23 replies
6h29m

We take the typical blog url design (/2024/08/14/slug) for granted but back in the very early 2000s pretty much every blog tool had its own URL design. Matthew Thomas back then took an inventory:

https://web.archive.org/web/20030810201315/http://mpt.phrase...

He was on the search for his ultimate blogging system, where this "cruft-free" URL structure should be used:

https://web.archive.org/web/20051107103030/http://mpt.phrase...

I could have sworn there was a changeset in which Matt Mullenweg was implementing those cruft-free URLs in his new fork called Wordpress, but trying for google for something with "Wordpress" from the early 2000s is basically impossible in 2024.

Update: I found this: https://ma.tt/2004/08/mike-on-uris/

twic
8 replies
5h52m

He calls file extensions cruft, but i've come to value them. They are a simple way to indicate file type - desired or offered - which is easily understood by machines and people.

I currently work with an API which does a bit of content negotiation using the Accept header, so clients can request data in various formats - application/json for a snapshot, text/event-stream for an updating feed, or text/html for an interactive dashboard. I wish it didn't. I wish we'd just used file extensions. Trivial to use in a browser or via curl, trivial to implement on either side.

crazygringo
3 replies
4h37m

That's fine (and already common) for images, JSON, etc.

But nobody wants webpage URL's that randomly end in .php, .htm, .html, .aspx, and so forth. That's just noise that is both gibberish and entirely irrelevant to the user.

codetrotter
2 replies
4h14m

.htm and .html is relevant just like .pdf and .zip etc etc

But I agree about .php, .aspx and other extensions that are telling something about the server side. That’s irrelevant for the user.

shawabawa3
1 replies
3h40m

.htm and .html is relevant just like .pdf and .zip etc etc

it's _kind of_ relevant, if it weren't for the fact that the absence of any extension implies .html >99% of the time

arethuza
0 replies
3h31m

Wouldn't that also include JSON for the other 47% of the time?

johannes1234321
2 replies
5h12m

He calls file extensions cruft

I think that refers mostly to the .php and .asp of the time. Those don't tell a thing to the user.

notRobot
1 replies
3h23m

I want users to know I use PHP! :D

notRobot
0 replies
3h22m

And I judge people who use ASP, lmao.

svieira
0 replies
5h22m

For _APIs_ I prefer to use both - the only downside is that resource names need to be restricted to _not_ include trailing `.{EXT}`s (either at all or limiting EXT to things that aren't valid content types).

E. g. `/books` - looks at the `Accept` header. `/books.json` - sets the `Accept` header to `application/json`. `/books.xml` - `application/xml`, and so on.

amadeuspagel
8 replies
5h0m

I guess this reflects a view of blogging that maybe is more what people today would use twitter or mastodon for, with lots of blogposts with the same title like "open thread" or "links for sunday". Today people mostly use blogs to publish essays, and then a slug based on the title should be sufficient, since you're not going to publish two essays with the same title. That's what substack uses.

crazygringo
5 replies
4h39m

I think the date is still extremely valuable. Knowing whether something is from last month or a decade ago makes a huge difference. It's also useful so that URL's can be sorted by date.

Also, "you're not going to publish two essays with the same title" feels false. If you write 1,000 pieces and use short titles and tend to write about the same subjects, it feels extremely likely that you'll wind up repeating titles.

freedomben
2 replies
4h19m

I agree, but I think it's important to note that the date in the URL can also be misleading. For example, it's often assigned at time of creation. If that page or post gets updated years later, even if almost entirely rewritten, it still has the original date in the URL

crazygringo
1 replies
3h40m

even if almost entirely rewritten, it still has the original date in the URL

If we're talking about blogs/news, they don't ever get almost entirely rewritten. The original publication is the only date that matters, and it matters a lot.

If we're talking about evergreen content like documentation, then of course you don't put dates in the URL. A small "last updated" on the page itself is appropriate there.

freedomben
0 replies
3h15m

If we're talking about blogs/news, they don't ever get almost entirely rewritten.

Unfortunately, this isn't the case. It should be the case IMHO, but it (currently) isn't. The SEO/marketing people nowadays (ab)use popular pages for the search rankings and update them regularly to keep the content fresh and highly ranked (since search engines give much preference to new content).

Also, even for strict blogs/news, it's not unusual for a particular post to be a draft for many months before publishing. Most serious blog will fix the date to match publish date, but that isn't what happens by default especially in Wordpress (which is the most important platform for blogs).

didntcheck
0 replies
4h10m

And it's sad how often one needs to use the URL to find the date, since many authors just don't put it on the page (corporate sites are particularly scared of dating their stuff)

Others seem to think just day and month is fine, as if the year isn't the most significant part. And if both numbers are <=12 then you have to go and find out what locale the author formats their dates in...

JohnFen
0 replies
4h36m

then a slug based on the title should be sufficient, since you're not going to publish two essays with the same title.

Disambiguation is one thing, but as a reader, I really like having the date indicated in the URL for informational purporses. It's very helpful.

notRobot
2 replies
3h24m

How do search engines figure out the date of webpages that don't contain it in the metadata?

reaperducer
0 replies
3h9m

How do search engines figure out the date of webpages that don't contain it in the metadata?

Poorly.

I have a blog so old I titled it an "online diary." It pre-dates search engines, so they tend to date the diary entries (blog posts) based on first crawl. Which means lot of the dates presented by the search engines are off by several years.

hansvm
0 replies
3h19m

The simplest version is recording the date they noticed a change in the page.

toyg
0 replies
6h2m

Well, arguably both Movable Type and Radio Userland's URLs were already pretty cruft-free. The success of Wordpress was mostly due to other factors (free, php, great feeds, great markup in default templates, great support for plugins).

wizerno
16 replies
7h54m

An example of a not-so-great URL design: Amazon product links have an optional slug before everything else like `{slug}/dp/{id}`. So you end up copying a gigantic URL everytime you wish to share a product unless you use the share product button to get the shortened link.

xyzzy_plugh
5 replies
6h44m

I think this is actually a really great design in that the name of the product can always be in the URL. The "slug" is completely ignored and just there for SEO/humans. If you send a link I instantly know what it's for -- that's pretty useful!

I also like that the "id" which is an ASIN (Amazon Standard Identification Number) which is a superset of all ISBNs. This means you can just enter any book ISBN directly into the browser and end up on the right page (at least historically) instead of having to search for it.

wizerno
2 replies
5h37m

While the slug helps someone know what they're opening before reading it, most apps have link previews which give you just enough information you need.

namrog84
1 replies
4h28m

I dont know if I'm in the minority but I really dislike link previews the vast majority of the time. They take up too much space and offer to little value. In discord I often x out of the preview and I know lots of others who do too.

Maybe on some sites it's fine but I feel like link previews need more modularity on size or something. Perbaps even configurable both host and client

xyzzy_plugh
0 replies
3h43m

You're not in the minority.

The information density of the preview has to match, if not exceed, that of the context in which it is provided. Most of the times it's a placeholder image with less text than the URL itself.

pests
0 replies
6h40m

This got a major retailor (Walmart maybe?) into issues awhile back as they were pulling the product title (only) from this param so people were having a heyday "renaming" official products on the official site.

fsckboy
0 replies
2h37m

>Amazon product links have an optional slug BEFORE everything else

I think this is actually a really great design in that the name of the product can always be in the URL

he said "before". you could accomplish your goal putting the slug "after". he's making the point that having a place after which you can harmlessly delete the rest of the url is better than having embedded NOPs surrounded by identifying information (not that the average user will ever edit any url, but there is still merit in what he said that you missed, and he's not disagreeing with you)

robin_reala
2 replies
7h32m

I just delete everything after the product ID manually. There are probably easier methods.

yoavm
1 replies
7h7m

The point is that the id comes last.

layer8
0 replies
6h6m

Which makes sense because URLs are often displayed such that only a prefix is visible. And for editing, it’s still easy to cut and paste the ID.

chamomeal
1 replies
6h26m

Lol this is almost the exact same thing as the very first example of good URI design in the article

wizerno
0 replies
5h34m

If you're referring to the StackOverflow example from the article, it's different because they follow `/questions/:id/:slug`. Keeping slug at the end makes it a lot easier to delete while keeping it readable.

JohnFen
1 replies
4h30m

So you end up copying a gigantic URL everytime you wish to share a product

Yeah, when I used Amazon I found this incredibly annoying. When I wanted to share a link, I'd have to spend a few minutes figuring out how much of that stuff I could remove and testing the resulting URL before sharing it. A relatively minor irritation, but an irritation nonetheless.

fsckboy
0 replies
2h30m

having, like you, studied amazon urls, I just automatically delete everything?inclusive after the "?", then I edit the slug to make it contain a message personalized for my recipient

ryukoposting
0 replies
5h52m

At least that stuff is actually informative to a human. A lot of Amazon's URL bloat is the analytics crap they shove into query string. I started using ClearURLs specifically because of Amazon.

layer8
0 replies
6h9m

It’s not that difficult to shorten it to the minimal “/dp/:id”. I always take care to do that when sharing an Amazon link.

crazygringo
0 replies
4h32m

It is a curious decision why they chose to put the ID before the slug.

Stack Overflow, in contrast, puts the ID first, followed by an often very long slug. Which seems to be the more common pattern generally, as far as I can tell.

I do wonder what their rationale was/is.

imrehg
10 replies
6h47m

I found Notion's URL schema interesting as well. They have to contend with renames of pages, reorganisation of the hierarchy and all that. So they have something like:

    notion.so/:account/Current-Name-of-Page-:pageid 
where the name changes if the page is renamed, but the redirect works, as the page ID is unchanged. In fact, one can just use

    notion.so/:account/:pageid 
and gets redirected to the right page, or even

    notion.so/:account/Anything-else-:pageid
works too...

This is very handy in my use cases, when various Notion data is extracted into another tool, reassembled, and then needed to have a link to the original page. I don't need to worry about the page's name, or how that name gets converted into the URL, or any race conditions....

The page hierarchy is then just within the navigaton, not in the URL, so moved pages continue to work too (even if this looks like a flatter hierarchy than it really is).

I'm sure there are plenty of drawbacks, but I've found it an interesting, pragmatic solution.

dgb23
4 replies
6h14m

I don't understand why the :pageid needs to be prefixed with anything here.

dijit
1 replies
6h6m

its for humans I would expect, to know what the page refers to without opening it.

Kinda smart.

Also; taking it from the end means you only need to parse the string as an offset from the end. It can make load balancing much faster in theory.

hobofan
0 replies
4h10m

It's also for crawlers. When doing technical SEO, having a human readable slug in the URL is low hanging fruit that is often overlooked. This, as well as having a <title> structure of `CURRENT_CONTENT_TITLE | WEBSITE_NAME` are things that are quite trivial to implement and provide a significant uplift in both SEO and UX.

toasterlovin
0 replies
4h11m

It’s for SEO. Perhaps it’s a historical concern and no longer relevant, but the URL is/was used by Google to understand what the page is about.

bathtub365
0 replies
6h6m

So you can tell what the URL might point to by looking at it. That’s one of the important things mentioned in the article linked on this HN post: URLs are used by both computers and people.

didntcheck
1 replies
4h2m

I've noticed that Confluence, Reddit, and a good number of news sites do the same thing. Usually the title segment is entirely ignored, meaning you can prank someone by changing the title part to something shocking, and it just redirects to the usual page, because the server only cared about the ID bit

The fact that so many sites do this (including "normie" news sites) shows that site designers clearly believe users want and expect "informational"/"denormalized" URLs, rather than /?id=123

simonw
0 replies
3h25m

It’s an SEO thing.

The better way to implement this is to serve a 301 redirect if the words in the URL don't match the expected ones, that avoids trickery and also removes the risk of the same page being accidentally indexed as duplicate content.

aqfamnzc
0 replies
6h33m

I believe amazon does something similar for product pages. The `/dp/` is the product id that really matters.

Kiro
0 replies
3h54m

Why end with the id instead of doing it like SO, as per the example in the article?

KMnO4
0 replies
3h39m

There is (was?) also a terrible flaw with this, in that any site hosted on Notion (even using its own domain) would show you public pages with a valid page id.

So, if Paul Graham hosted his site via Notion (he doesn't), I could link someone to `https://paulgraham.com/Why-I-Hate-Hackernews-be2839f0-e145-4...` and it would show my (fake) page on PG's domain.

aejm
8 replies
7h40m

What’s the best way to handle url slugs that change? For example, if I have www.example.com/page/foo, and the user changes that page’s title to bar, the slug updates to www.example.com/page/bar and anyone visiting the old url gets automatically redirected to the new one. But now the old slug of foo can’t be used again (without appending some unique identifier to it, like foo-th683gh9i).

msoad
5 replies
7h35m

The first example is just that. Put the id in the URL and make the slug optional.

Stackoverflow makes the slug completely optional but you have the choice of only accepting foo and bar in your example

hmry
0 replies
7h12m

What is the actual harm in allowing people to put random text at the end of the url?

Not to mention something similar can be done to any url, e.g. #whatever-you-want or ?_=whatever-you-want

christina97
0 replies
7h14m

No you redirect to the right place. It’s no worse than writing obscene things in a URL fragment (after #) that doesn’t even get sent to the server.

alpinisme
0 replies
7h5m

It’s not great but it matters less when the content you get going to that page is so unremarkable. Don’t forget you can do that to any url, even of sites that don’t use optional slugs, if your goal is just vague, evil-by-link-appearance.

isoprophlex
1 replies
7h32m

/page/:id/:slug-you-ignore, as in TFA. The id doesn't change, and the slug can be anything.

cthor
0 replies
6h26m

Rather than totally ignoring the slug, I prefer sending a 302 to the correct slug if the slug is absent or incorrect.

ceejayoz
1 replies
7h0m

I still chuckle at the expertsexchange.com -> experts-exchange.com migration.

rambambram
0 replies
5h39m

"Q: Can I provide my own wood? A: In most cases we can handle your wood. We do require all shipments to be clean, free of parasites and pass all standard customs inspections."

ralferoo
0 replies
6h32m

There was another classic from that era, powergenitalia.com, which purported to be the Italian division of Powergen, has now disappeared and apparently was a prank. Interestingly, some of the early captures of it seem to be another company, so maybe it was just an early attempt at SEO and they might have removed it due to the risk of being sued for trademark infringement: https://web.archive.org/web/20040830080331/http://powergenit...

Hamuko
0 replies
7h9m

I was once linked fagasstraps.com on an IRC channel and I expected something else.

robin_reala
6 replies
5h36m

Back when I was working on GOV.UK Verify we had URLs that looked something like /verify-passport for English and /cy/verify-passport for Welsh. I made the decision that if readable URLs was a design goal they should be readable in both languages, and ended up localising them all to (for example) /verify-passport and /gwirio-pasbort. No idea if anyone ever noticed, but sometimes it’s nice to sweat the small stuff.

marcinreal
1 replies
5h12m

I had the same thought for a restaurant website that served multiple languages. I figured customers might glance at the URL when it's being shared, and appreciate it being in their language.

What do you do when the translated slug happens to be the same in multiple languages? I ended up still having the country code in the slug.

robin_reala
0 replies
5h10m

Luckily we only had <10 user-visible pages in our part of the service, so I didn’t have to worry about that.

travisjungroth
0 replies
3h14m

I’m going to make a business website in 7+ languages and this comment makes me want to do the same thing with the URLs. Thanks!

simonw
0 replies
3h24m

That’s classy.

nicbou
0 replies
3h42m

This is important to do, in my opinion. You should not assume that non-English-speaking users all understand a little bit of English. It also confers some SEO benefits.

That being said, if the URL has a language code (/en/), it would be good to change the language code manually, and still end up on the right page. Sometimes the language switcher is really well hidden. However a visible language switcher is even better.

ave_b_2011
0 replies
4h18m

I really like this - because technology is for everyone but can end up being harder to use because of design decisions. Thanks for sharing this.

msoad
5 replies
7h31m

One big question in URL design is this:

Do path parameters get to have / in their values?

Let’s say you have a link shortener service and want to allow users to define shortcuts like /mypath/:rest where rest is appended to example.com/

Now you’re in a very interesting position when it comes to resolving URLs.

Curious to hear folks with experience in this

vrnvu
2 replies
6h34m

This can be a complex topic if you don’t set clear constraints on what constitutes a valid character in your URL or domain.

For instance, in query parameters, spaces are encoded as '+'. But what if '+' is also a valid character in your domain? You then need to disambiguate i.e between "name?foo+bar" meaning "foo bar" or "foo+bar". Which one is the user actually referring to?

In our case, we ended up needing users to send the name in the body, and now we have to manage multiple encoding protocols (url, queryparam, the body...).

oneeyedpigeon
1 replies
5h50m

Wouldn't you just encode the "+" if you wanted it as a literal?

vrnvu
0 replies
4h34m

A better example is the name: "foo%20bar".

A user might have entities named "foo bar", "foo%20bar", and "foo%2520bar". Sometimes, mistakes happened because users forgot to double encode or they used the wrong protocol. As this names were used in URL, query parameters, and the body, and each has its own.

As I mentioned, with clear constraints and rules, we can accomplish anything we need, it can get complex. My takeaway from this project is to limit the valid characters and make it simple for everyone.

wizerno
1 replies
7h18m

As per RFC 3986 [1], reserved characters such as , and / must be URL encoded.

, is encoded as %2C

/ is encoded as %2F

[1] https://www.rfc-editor.org/rfc/rfc3986

msoad
0 replies
5h12m

That's not the question. The question is what if you have an open ended URL param that can also have subpaths?

pornel
4 replies
7h20m

Using a numeric ID + ignored path part is easy to implement, but actually using the textual part without an exposed ID seems more elegant to me. Tip for implementing that:

* have a separate table that maps slugs to IDs, allowing many-to-one relationship, because content's title will be updated, and you don't want to break old links.

* long slugs will get truncated by users. A zero-cost way to recover from that is `select id where slug >= ? order by slug limit 1`

* in either case don't forget to redirect to the canonical URL, so that people can't create duplicate or misleading URLs on your site.

RugnirViking
2 replies
6h49m

the problem with that, as mentioned in the article, is that that breaks if the content of the page changes. So on stack overflow for example, what happens if someone changes the title of their question? you either break the url or use an old version of the title, thus being misleading.

oneeyedpigeon
0 replies
5h51m

Changing the title of the question is the real wtf.

atlintots
0 replies
6h44m

that's what the many-to-one slug-to-id mapping is for

lifthrasiir
0 replies
7h9m

I don't like slug-only URLs because they are hard to make concise. If the textual part can be compressed into one or two words, like what qntm does in his website, then it is okay, but most schemes do not really care much about slugs...

bnc319
4 replies
6h44m

I forget where I ran across it, but one interesting adoption of URL design is to make the root of the directory part of the site's domain name. I.e. there was someone's website that was shared on HN, where their name was assembled with the domain name, TLD, and some characters after the first slash:

  firstna.me/lastname/
  firstna.me/lastname/about

toyg
1 replies
5h58m

This arguably started with del.icio.us.

oneeyedpigeon
0 replies
5h52m

And I'm so glad they eventually registered delicious.com (or whatever it was) because remembering exactly where those "."s went was a real pain.

tomooot
0 replies
6h10m

One example that springs to mind is the documentation site for WLED, an incredibly powerful microcontroller firmware for controlling addressable LEDs:

https://kno.wled.ge/

p1nkpineapple
0 replies
5h42m

For another example, the recently featured https://fastht.ml/

simonw
3 replies
3h20m

I’m glad this article mentions GitHub, who have had some of the best URL design I’ve ever seen, and have done since they first launched.

I use that ALL the time. I can navigate straight to any issue by typing a URL. I can switch to the “actions” view for a repo by adding /actions. I can see the file I’m looking at in a branch by editing the URL and swapping “main” for the branch name.

All available via the UI as well, but I interact with GitHub so often that the tiny efficiency boost I get from navigating by URLs really starts to add up.

I also trust them not to break links, based on their track record. My notes and blog posts and even my source code are full of links to issues or code snippets on GitHub.

c-hendricks
1 replies
3h17m

do these routes on github irk anyone else:

    /issues/
    /issues/:id
    /pulls/
    /pull/:id

heinrich5991
0 replies
1h22m

Even worse:

    /issues/
    /issues/:id
    /pulls/
    /pulls/:author
    /pull/:id

berkes
0 replies
3h1m

I believe this is a (happy) legacy from Rails.

In rails, if you don't spend effort to undo, you get URLs that match your database setup in a RESTful way. For me, that's far to tight coupling, and problematic in other ways.

But the result is that without thinking about it, without a second of time spent on designing an URL structure, you get a very nice, consistent and clean one for free.

kijin
3 replies
6h46m

I might be an outlier, but I don't like slugs in URLs.

They make URLs unnecessarily long, often forcing people to use URL shorteners -- completely defeating the purpose.

They get awkward when the author changes the title. Other commenters mentioned some tricks to get around this issue, but all involve redirects. Cools URLs shouldn't change in the first place.

They don't copy cleanly if you use nonalphanumeric characters, as in nearly every language other than English.

Virtually nobody just looks at a URL these days anyway, with all the search engines, cute thumbnails, and OpenGraph metadata that provide a glimpse of the actual content for you before you even click on it. This is doubly true in the non-English-speaking parts of the world where a slug in a shared URL is often just a jumble of %HEX.

Hand-picked words in URLs are fine, e.g. /about/me. I'm only talking about autogenerated slugs for user-submitted content above.

dbg31415
0 replies
3h28m

URL shorteners are more for UTM tracking codes. Those get long.

betagam
0 replies
5h37m

On the other hand, slugs may save you a long page load. Which is useful for users with slow internet.

Sharparam
0 replies
4h46m

They don't copy cleanly if you use nonalphanumeric characters, as in nearly every language other than English.

I haven't noticed this ever being an issue.

At least in Firefox, non-ASCII characters will show as-is in the URL bar, but in the copied URL they will be properly encoded.

syspec
0 replies
4h38m

I agree that is a cool feature. I would say it's from its Rails background where such a thing is encouraged (.json or .html (or no extension)) on a resource give you two different outputs

shahzaibmushtaq
2 replies
6h5m

Understanding the URL structure of any site can also help you see things that are not accessible through the UI.

n_plus_1_acc
1 replies
5h39m

Be aware of CFAA tho

shahzaibmushtaq
0 replies
3h3m

Yes, for ethical uses and purposes

pyinstallwoes
2 replies
3h38m

Everything should be accessible via the identity of its composition (a hash or equivalent). Then all the data needed to render it be computed or downloaded from some peered cache (DHT).

MrThoughtful
1 replies
3h27m

So when you bookmark the Hacker News frontpage, that would be a hash of its current content and then you will visit that stale stale version forever and never see any new stories?

mrweasel
2 replies
5h18m

The Slack URL scheme, and a few others mentioned in other comments take me right back to hp.com/go/<Insert Product>, so hp.com/go/proliant would take you to Proliant servers, maybe.

The idea was really cool, but from talking to people at HP at the time, the implementation was apparently a complete nightmare done with an insane number of rewrites. It was sort of a hit and miss if the thing you typed in after /go/ would actually take you to the correct location, if any.

anamexis
1 replies
4h54m

How was the implementation hard? It seems like it would be a bog-standard set of redirect rules.

mrweasel
0 replies
2h5m

It was the shear amount of them that was the problem. Plus this was in the early 2000s and they where, if I recall the story correctly, manually managed.

TreetopPlace
2 replies
6h39m

I don't think will be relevant going forward, Safari already hides the URL beyond the domain name by default, and I presume other browsers do/will too.

kibwen
0 replies
6h33m

As the article mentions, URLs are used in more contexts than being displayed in the address bar, so the content remains relevant regardless of Safari's poor aesthetic decisions.

al_borland
0 replies
5h31m

This can be turned off. It’s one of the first things I do when getting a new Mac.

65
2 replies
3h54m

How about great email address design? Of course firstname@lastname.com is top tier. But there are some interesting hacks you can do, such as firstn@melastname.com if your last name domain isn't available.

mbb70
0 replies
3h35m

I never thought of this! I have an 'a' in my first name but just checked, 'rest of my first name + last name'.com is already taken. Oh well, I already have 'my initials'.dev, it'll have to do.

WickyNilliams
0 replies
3h20m

Not sure it counts but mine is wicky(AT)nillia(DOT)ms. Which aligns with my username practically everywhere, and is a spoonerism of my actual name.

The downside is that it's a massive pain to explain to people verbally!

jbverschoor
1 replies
6h34m

What about the trailing slash? It annoys the hell out of me, but apple also seems to use it

dbg31415
0 replies
3h29m

Doesn’t matter. Use them, don’t. Doesn’t matter.

hartator
1 replies
3h35m

website under a .is domain (which is for Iceland, apparently).

I don’t super like repurposing country names like that. Including .io.

It feels this disregards the actual meaning of the extension while ignoring some very legal consequences to be under Indian legal system instead of EU or US.

Liquix
0 replies
3h7m

To be fair most countries rolling out ccTLDs these days aren't doing it so patriotic citizens can represent their home country - it's an international cash grab. They're fine with randoms from all over the world giving them money, so randoms from all over the world are welcome to use their ccTLDs.

frereubu
1 replies
7h27m

I can't check this because I'm on mobile, but I presume Stack Overflow uses a canonical tag in the HTML to state their preference that the longer version with the slug should be the default, because that's the one search engines use.

aembleton
0 replies
5h17m

Stack Overflow returns with a 301 and a location header containing the slug.

https://stackoverflow.com/questions/16245767

Responds with a 301 and a location header value of `/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript`

amadeuspagel
1 replies
5h2m

I think the URL design of stackoverflow leavs room for improvement. The id should not be necessary. StackOverflow demands unique questions. If a question doesn't have a unique slug, is the question unique? Great URL design to me is if the slug is suffficient for uniqueness, without an id.

arccy
0 replies
5h0m

you should be able to refine question titles

yoshyosh
0 replies
7h34m

Love this. A big miss teams have are with affiliate/refer a friend urls. Like if you think of your Uber referral code being 5 characters instead of a general 16 character hash. Shorter makes it easier for people to remember and share their code.

e.g. RJF01 vs ab0fhct99fh2h4fqi2fj9

velcrovan
0 replies
4h44m

I like the slack.com/is/ scheme that makes the resource into a simple, legible phrase. I do something similar on my site: everything in the "projects" category has a URL that starts with "what-about", e.g.: https://joeldueck.com/what-about/splitflap/

tracker1
0 replies
4h29m

Note, if you are using optional slugs or otherwise, you should have a canonical url in the header so that search results will be collated to a single canonical url.

skc
0 replies
6h22m

Microsoft have left the chat

robertclaus
0 replies
5h1m

From a URL=Resource perspective I don't love unstructured strings in the url because they make it trickier (never impossible) to extend with sub-resources. For example, if I have a url for a blog post with a slug, it's more difficult to represent a comment as a sub-record of that post:

`my.domain/post/123/my-great-slug-that-is-pretty-long-but-doesnt-matter/comment/456`

vs

`my.domain/post/123/comment/456`

ricardo81
0 replies
6h55m

id's that skip the textual part on their lookup/url validation and also don't redirect are not ideal, probably as bad as soft 404s. Maybe not as bad for bots if the canonical tag shows the intended URL.

Personally I'd avoid using id's and use a 32-bit hash of the URL which is more or less as performant as a straight id lookup. I usually went with murmurhash.

raldi
0 replies
4h32m

I always liked that you can prepend reddit.com/ or redd.it/ to any URL (http and all) and get taken to a prefilled submit page for it.

palijer
0 replies
5h30m

I gotta say, Datadog does this pretty well. They manage all their state (just information state, not like user sessions lol) in the URL, which makes it easy to integrate with and dynamically generate links and share information, and manages to stay human readable.

p4bl0
0 replies
7h2m

Similar to the Slack example given in the post with /is/ URLs, KDE has /for/ URLs with pages which present the KDE project and software for various user profiles: developers, kids, scientists, students, creators, gamers, activists, etc.

See all these pages here: https://kde.org/for/

nullhole
0 replies
3h6m

The Reuters links are an example of good links IMHO. They're not earth-shattering, and follow some fairly generic guidelines, but work quite well.

Format is reuters.com/:category/:headline:date

which is all you need to know what you're clicking on. For example, I don't need to describe this link in order for its contents - and its time-relevance - to be understood:

  https://www.reuters.com/world/us-navys-newest-air-to-air-missile-could-tilt-balance-south-china-sea-2024-08-14/
Edit: they are a bit long, though, I suppose

moondev
0 replies
4h33m

When you want to "go run" but all you have is curl and a prayer

https://goblin.run

jimniels
0 replies
4h57m

Post author here. There are so many great additional examples of intriguing URL patterns in the comments here. TY everyone for sharing ones you remember!

hdjjhhvvhga
0 replies
6h5m

Granted, it can also be used deceptively. For example, this is the same URL as above but it portends completely different contents (without breaking the link):

stackoverflow.com/questions/16245767/how-to-bake-a-cake

Fortunately for SO the fake slug is not preserved and redirects to the real one (so e.g. stackoverflow.com/questions/16245767/motheficker is not served from their site), much to the chagrin those of us with childish sense of humor who some 25 years ago enjoyed dynamically generated nonsense like:

https://web.archive.org/web/20031007123544/http://john.isgay...

hcarvalhoalves
0 replies
4h8m

Unfortunately these practices are biased to the English language, as slugs are limited to ASCII.

franze
0 replies
6h16m

These are my URL rules, in any project where I or my clients violate one of the rules - or their priority, we will regret it down the road.

URL-rules

URL-Rule 1: unique (1 URL == 1 resource, 1 resource == 1 URL)

URL-Rule 2: permanent (they do not change, no dependencies to anything)

URL-Rule 3: manageable (equals measurable, 1 logic per site section, no complicated exceptions, no exceptions)

URL-Rule 4: easily scalable logic

URL-Rule 5: short

URL-Rule 6: with a variation (partial) of the targeted phrase

URL-Rule 1 is more important than 1 to 6 combined,

URL-Rule 2 is more important than 2 to 6 combined,

URL-Rule 3 is more important than 3 to 6 combined,

URL-Rule 4 is more important than 4 to 6 combined.

URL-Rule 5 and 6 are a trade-off. 6 is the least important.

A truly search optimized URL must fulfill all URL-Rules.

My preferred URL structure is:

https://www.example.com/%short-namespace%/%unique-slug%

https:// – protocol

www – subdomain

example – brand

.com – general TLD or country TLD

%short-namespace% – one or two letters that identify the page type, no dependency to any site hierarchy

%unique-slug% – only use a-z, 0-9, and – in the slug, no double — and no – or – at the end. Only use “speaking slugs” if you have them under your total editorial control.

i.e.:

https://www.example.com/a/artikel-name

https://www.example.com/c/cool-list

https://www.example.com/p/12345 (does not fulfill the least important URL-Rule 6)

https://www.example.com/p/12345-product-name

efortis
0 replies
2h59m

I used my.lan for my local net

I changed it to home.arpa, but I forgot why

dbg31415
0 replies
4h8m

Just remember to build localization into your URLs.

mysite.com/en-us/some-page mysite.com/en-ca/some-page

You can 301 redirect some locale to your "base" URL if you want.

mysite.com/en-us/some-page > mysite.com/some-page

But don't stress too much. Google doesn't really care about URL content any more. People on phones don't care what your URL says. It's at most desktop users, and devs.

Don't stress localizing your URLs...

mysite.com/fr-ca/some-page is just as good as mysite.com/fr-ca/une-page... and the former is a lot easier to tie into email marketing variables.

Just keep your sitemaps in the localized folder.

mysite.com/sitemap.xml... just a link to the various localized sitemaps.

mysite.com/en-us/sitemap.xml etc.

By keeping sitemaps in a localized folder, it'll make it a lot easier for yourself as you go to register your site with each market's locale.

If you just have to localize URLs... consider doing what Amazon does and just tie the URL to an ID.

https://www.amazon.com/Moen-One-Handle-Bathroom-Deckplate-84...

the above is the same as this... https://www.amazon.com/dp/B0CFYPTKF8

And you can put anything you want in the URL string, it just matches on the ID.

https://www.amazon.com/literally-whatever-you-want-here/dp/B...

“We use the words in a URL as a very very lightweight factor. And from what I recall this is primarily something that we would take into account when we haven’t had access to the content yet… [but] as soon as we’ve crawled and indexed the content there then we have a lot more information. And then that’s something where essentially if the URL is in German or in Japanese or in English it’s pretty much the same thing.”

- John Mueller, Google Search Advocate.

cynicalpeace
0 replies
5h8m

I've come to regret that most of my projects have this URL design- mainly because it gets harder to track via third party analytics platforms like Sentry and Clarity.

eg. series/9876545678 and series/098767890 get treated differently and the analytics get difficult to merge. But really they're the same page just hydrated with different data.

Should've used query params, eg series?id=9876545678

acjohnson55
0 replies
3h12m

It was cool to see Jessica Hische called out. We own a couple of her children's books. Always fun when my parenting and tech worlds collide in surprising ways.

Sephr
0 replies
3h28m

Another interesting related area is designing URLs for third-party components.

Third-party component have to coexist with existing site navigation logic, so generally you can't safely add URL-based configuration to such a component.

Fortunately, configuration can now be stored in fragment directives in order to hide this from normal site routing. e.g.

  https://example.com/page#routing-info:~:additional-routing-info-for-third-party-component
With fragment directives, location.href and location.hash exclude the additional content in the hash after :~:

This is used in Transcend Consent Management for configuring parameters to debug and simulate various privacy experiences[1].

1. https://docs.transcend.io/docs/consent-management/reference/...

AstroJetson
0 replies
5h48m

Wordpress gives a few good options to use slugs or names in a hierarchy.