URL Slugs: Redirects or 404s?

Posted by anonymous coward on Stack Overflow See other posts from Stack Overflow or by anonymous coward
Published on 2010-03-24T20:10:53Z Indexed on 2010/03/24 20:13 UTC
Read the original article Hit count: 372

Filed under:
|
|
|

Some sites, like here at SO, allow 'bogus' slugs in the URL. Before implementing URL slugs on my site, I have a question of 'best practices'...

Given a structure like example.com/123/article-slug-here/, if my site allows bogus slugs by querying on the ID -

Should I ...

  • just do a redirect to the appropriate/canonical URL (verifying the slug, and redirecting in case of a mismatch)?

-or-

  • return a 404, since technically example.com/123/this-article-s-u-x doesn't exist?

© Stack Overflow or respective owner

Related posts about url

Related posts about web-development