views:

70

answers:

1

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?
+1  A: 

Neither. Leave it as it is. Google will figure out the canonical url and keep them in their index.

You could do redirect (301 Moved Permanently of course) only if you wish to punch Google to update the changed url in their index more quickly. If it's not important, no need to bother.

P.S. I basically did the same thing in my blog. Once I changed the title of some entry and after a while (a few weeks) Google updated their index in accordance to the new canonical url that was specified in the page. Simple and works.

Developer Art
If it works for Stack Overflow, it's good enough for me.
Dominic Rodger
Accepted answer because there haven't been any others for over a month. While this does seem to be working in practice, on popular websites of today, it still seems odd to me and makes me a bit uncomfortable. Ah, well.
anonymous coward