I am using UrlReqritingNet to include url routing in my asp.net 2.0 application.
I want to change
http://mysite.com/book/detail.aspx?id=4
to this:
http://mysite.com/book/a-tale-of-two-cities
The book is stored in a database, 4 being the the unique primary key of the book.
However using this url I am forced to do a database lookup using the book’s name rather than the id. I’d much prefer to use the unique id instead.
The obvious solution is:
http://mysite.com/book/4
or
http://mysite.com/book/a-tale-of-two-cities?id=4
Taking SEO in to consideration, are either of those urls ideal?
Thanks
Why not do it exactly as StackOverflow does on this very page?
http://mysite.com/book/4/a-tale-of-two-cities?id=4Put the ID in the URL before the slug. That way if the slug is ever cut off you still have everything you need to retrieve that page.