我想知道为什么个人资料的链接看起来像:
http://stackoverflow.com/users/ID/NAME
不仅仅是:
http://stackoverflow.com/users/ID
甚至更好:
http://stackoverflow.com/users/NAME
可以有几个同名的用户吗?还是一个用户可以有多个名字?
最佳答案
所有 SO-URL 都是 id/description 形式,其中 ID 是唯一的,描述是可选的。所以/users/12890/arne-burmeister
与/users/12890/huhu
相同和 /questions/420380/why-does-the-link-to-the-user-profile-have-both-id-and-name
与/questions/420380/foo
相同.检索仅使用 ID,但当 user/question/what-ever-should-be-found 出现在 URL 中时,它对 google 排名要好得多(对于人类来说,这也更具描述性;-)。
顺便说一句,通过ID检索比通过这么大的文本字符串检索要快。当然,如果有人更改了用户名或问题,该 URL 仍然有效。
关于url - 为什么有些网址同时包含数字 ID 和名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/420380/