←back to thread

569 points todsacerdoti | 2 comments | | HN request time: 0s | source
Show context
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 #
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 #
1. 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 #
2. nayuki ◴[] No.42617947[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.