-3

Stack Exchange question URLs are in the format:

https://meta.stackexchange.com/questions/36714/logic-behind-stackoverflow-question-ids

The number part is the ID of the question. The URL would be more human-friendly if it didn't have the number. Are there good reasons why URLs have the question ID in them?

8
  • The logic-behind... part is actually redundant. (meta.stackexchange.com/questions/36714/…)
    – AJN
    Aug 26, 2021 at 14:15
  • 4
    So... I'd like to say... I understand maybe why people are downvoting here but I think that considering there's a clear answer for it, it's not actually a bad question. Not everyone understands all of the considerations for why a platform builds links to their content the way they do... so maybe let's not judge people by what they don't know?
    – Catija StaffMod
    Aug 26, 2021 at 14:37
  • 1
    @Catija what do you think is the reason people are downvoting? Aug 26, 2021 at 14:39
  • 4
    @multigoodverse Personally I downvoted because I find your claim that without number it would be more human-friendly a bit rude. I prefer to read a short number over a long text. Much easier to compare, much less prone for typos, much shorter to include in comments etc. - I'm not less human just because I like numbers. Aug 26, 2021 at 15:05
  • 1
    @samcarter_is_at_topanswers.xyz I think that the point that it's more human friendly is less numbers vs words and more "there are thousands (millions) of questions - you can't possibly remember the post IDs for every single one, so having the title in the link helps us as humans have a quick reference for what the question is about".... If you can remember the title of every question ID without the link, that's amazing! But I think most of us do not.
    – Catija StaffMod
    Aug 26, 2021 at 15:47
  • 4
    @Catija Part of the point is that the title of a question is mutable. That you happen to remember a question title doesn't allow you to guarantee you're able to get back to the question, as the title may have completely changed. Thus, while having the question title is helpful, and will often allow people to re-find a question, it doesn't allow knowing the question you're looking at is, in fact, the question you were trying to find, as some new question may have the title you're looking for after the title was released by an edit to the title for the question you're really looking for.
    – Makyen
    Aug 26, 2021 at 16:53
  • 1
    @Catija in addition to what Makyen said, there is also a question of getting offensive or inappropriate content in your browsing history (or even looking at again) when you do not browse incognito. I have thick enough skin to handle that, but it's something that would not be a problem with pure identifiers (not that I am complaining about the current hybrid approach - I think it is ok overall). Aug 26, 2021 at 18:36
  • I'm... not arguing that, @Makyen ... but if I have a post where I'm listing a dozen links to questions, the postID only link is useless to me. I rely on the title content to distinguish between the posts. That's... literally more human friendly. That's all I'm talking about here. I'm not talking about longevity, though I (and others) do intentionally write titles in a way that uses terms I can find again quickly... I don't look for post 225370 - I search for "another castle".
    – Catija StaffMod
    Aug 26, 2021 at 18:40

2 Answers 2

16

The current link to your question is

https://meta.stackexchange.com/questions/369025/why-does-stackexchange-use-a-number-in-its-question-urls

I'm going to edit it now, because Stack Exchange needs to be written with a space in between, see the Trademark Guidance.

That will change the URL to

https://meta.stackexchange.com/questions/369025/why-does-stack-exchange-use-a-number-in-its-question-urls

but the old URL will still work (you can try it!). But without the question ID, the old URL would be

https://meta.stackexchange.com/questions/why-does-stackexchange-use-a-number-in-its-question-urls

which would no longer work; only the new URL

https://meta.stackexchange.com/questions/why-does-stack-exchange-use-a-number-in-its-question-urls

would. Now, this is a trivial edit, perhaps a smart system would be able to deduce this, but as you know it's possible to change the title to something else entirely (sometimes with good reasons!) - there's no way a system would be able to account for this.

The URL would be more human-friendly if it didn't have the number.

There are better solutions for that:

enter image description here

7
  • >" but the old URL will still work (you can try it!). " The old URL and the new URL could still both work, even if a unique ID was not implemented in the URL. I create a title. You edit it. Your URL redirects to mine and vice-versa. I don't see the need of an ID for that purpose. Aug 26, 2021 at 14:44
  • 11
    So no one can ever reuse a title that was part of any revision for any question ever?
    – bobble
    Aug 26, 2021 at 14:46
  • 7
    @multigoodverse a unique ID is much simpler to implement. Check a product detail page on an e-commerce website; it has a unique ID too (but in Amazon's case, it's further down the URL).
    – Glorfindel Mod
    Aug 26, 2021 at 14:50
  • I guess that makes big sites such as Wikipedia badly designed — there are no IDs in Wikipedia page links. Aug 26, 2021 at 14:55
  • 14
    @multigoodverse Of note, as a result of not using IDs, Wikipedia has countless disambiguation pages that they have to constantly be careful about. Well, not truly countless, but 327,985 article disambiguation pages is a lot Aug 26, 2021 at 14:56
  • @Medix2 exactly. Avoiding duplicate URLs is the reason behind having the ID in the URL. Editing the title afterwards which is what this answer is advocating is a sub-reason of that. The main reason is avoiding duplication. Duplication could happen when editing an existing title or when adding a new title that already exists. This is the point I also tried to make in the comments (now deleted by someone) in my original question. Aug 26, 2021 at 15:10
  • @multigoodverse Adding a title which already exists would be caught much earlier: meta.stackoverflow.com/a/346416/2777074 - not a problem for the url Aug 26, 2021 at 15:30
15

All posts are referred to by an ID number. It's not only questions. Every question and answer has a sequential post ID that shares an order - a question and an answer will never have the same ID as each other on the same Stack Exchange site. These ID numbers are stored in our database as the one true reference to any post. In combination with the site URL, they're unique.

We use IDs everywhere - this is what allows usernames to be non-unique - we don't care about the text you choose for your username, we only care about the profile ID you're assigned when you join the site.

This makes it really simple to allow for the editing of the title or a username without mucking with the links and having to create redirects every single time someone updates the title of the question or their username. The system simply ignores the information after the ID as it's mostly just there to be more understandable to people, particularly in a long list of URLs.

Having the title text included in the link to questions is actually to help it be human-readable and search engine friendly, which I personally use a lot - unless I need the short version of the URL for space concerns, I always use the full-length URL.

So, we do both! We help the system be more simple by including the ID number and we help it be readable by people by including the title.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .