by aflukasz · 1y ago · 0 comments
I wish there was one more paragraph though:
"I don't use trailing slashes in article URLs. Blog post is a file, not an index of a directory, so why pretend otherwise?"
But then it's http://rachelbythebay.com/w/2025/01/04/cruft/ , so I guess they don't agree.
Later on Web servers made it easier to load foo.html for example.com/foo, but that wasn't always the case.
It's been a couple of decades since I had to do it, but at least that's my memory on why I've been doing this since forever (including on newer websites, which is admittedly a mistake).
Note that both trailing slash variant examples you have provided (HN and Google) do redirect to non slash ones.
In fact, personally, I don't expect leading slashes for main pages.
> both trailing slash variant examples you have provided (HN and Google) do redirect to non slash ones
This is incorrect. Chrome (and Firefox by default?) have the broken behavior of showing bare URLs like "google.com" or even "https://google.com". But this is absolutely wrong according to the URL spec and HTTP spec. After all, even if you want to visit "https://google.com", the first line that your browser sends is "GET / HTTP/1.1". Notice the slash there - it is mandatory, as you cannot request a blank path.
Things were better in the old days when browsers didn't mess around with reformatting URLs for display to make them "look" human-friendly. I don't want "www." implicitly stripped away. I don't want the protocol stripped away. I don't want the domain name to be in black but the rest of the text to be in light gray. I just want honest, literal URLs.
In Firefox, this can be accomplished by setting: browser.urlbar.formatting.enabled = false; browser.urlbar.trimURLs = false.
But is an article an index to the attached media? Not even "just", but "at all"? Is this the right abstraction? Or do we have a better one, achievable by simply removing the trailing slash?
We discuss this in the context of cruft, user friendliness, and selecting proper forms of expression, which the original article seems to be all about, by the way.
Unlike in file systems, we don’t have the directory–file distinction on the web, from the user perspective. Everything shown in the browser window is a page. We might as well end them with a slash. If anything, there is a page–file distinction (page display in the browser vs. file download). I agree that URLs for single-file downloads (PDFs, images, whatever) should not have a trailing slash.