Best way to format pretty URLs for numeric IDs

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

    For SEO/traffic, definitely no.2 without a doubt. Get those meaningless numbers out of the URL every single time.

    www.example.com/topic/this-is-a-forum-post

    pickup the "this-is-a-forum-post" from your database and map it back to the ID number within your database via a query. Then do an internal URL re-write to the real page, something like /topic.php?ID=324342

提交回复
热议问题