Best way to format pretty URLs for numeric IDs

后端 未结 10 1960
谎友^
谎友^ 2021-02-02 02:48

Alright, so let\'s say I\'m writing a forum application, and I want pretty URLs. However, all my tables use numeric IDs, so I\'m not sure the best way to format the URLs for tho

10条回答
  •  情深已故
    2021-02-02 03:38

    URL 1 is definitely suboptimal. URL 2 is attractive but you run the risk of confusion if tags collide, especially if they differ only in punctuation. So I'd say URL 3 is the clear winner.

    Also note that just because you display URL 3 is no reason not to accept all 3, with the other two redirecting. If URL 2 is ambiguous, it should redirect to a disambiguation page.

提交回复
热议问题