Best way to format pretty URLs for numeric IDs

后端 未结 10 1874
谎友^
谎友^ 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:26

    1. Doesn't include the title, so you'll lose the additional SEO value of having those keywords in the URL.

    2. Won't work well, because it doesn't have a unique numerical ID, so what are you going to do if someone else tries to post a topic titled "This is a forum post"? Then you start getting into the weird thing digg does, where it has to give the second one the url "http://www.example.com/topic/this-is-a-forum-post_2", and so on. It makes it harder to take the URL they tried to load, and figure out exactly which topic they were trying to get to.

    3. Has the best of both worlds, this would be my style of choice.

提交回复
热议问题