←back to thread

569 points todsacerdoti | 8 comments | | HN request time: 0.871s | source | bottom
1. aflukasz ◴[] No.42604808[source]
Nice read.

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.

replies(3): >>42606679 #>>42606962 #>>42608188 #
2. tasn ◴[] No.42606679[source]
Back in the day it used to be the way to do it. Web servers would serve example.com/foo/index.html when visiting example.com/foo/ and it was the easy way of not having example.com/foo.html as your URL.

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).

3. layer8 ◴[] No.42606962[source]
I like it as a clear visual indication of where the URL ends. And a page often consists of more than just one file (images etc.) (the HTML portion of the page is just an implicit index.html in the directory), so it does make some sense.
replies(1): >>42609489 #
4. zamadatix ◴[] No.42608188[source]
I've got nothing against it. Just parse it as "the default file for that path" since one isn't specified. Just like you expect that for the main page e.g. "https://news.ycombinator.com/" or "https://google.com/" except as a subdirectory.
replies(1): >>42609260 #
5. aflukasz ◴[] No.42609260[source]
I do parse it that way. My position is that it's not the proper form for the function.

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.

replies(1): >>42617947 #
6. aflukasz ◴[] No.42609489[source]
I like your argument about implicit index.

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.

replies(1): >>42612776 #
7. layer8 ◴[] No.42612776{3}[source]
My point is that “an article” generally doesn’t consist of just a single file. Or maybe rather, that the distinction between a file or document and a folder isn’t necessarily meaningful. Physical “files” (i.e. on paper, as in a filing cabinet) actually commonly used to be folders. And there is little difference between a zip file (which are used for a number of popular document formats) and the unzipped directory it contains.

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.

8. nayuki ◴[] No.42617947{3}[source]
>> "https://news.ycombinator.com/" or "https://google.com/"

> 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.