开发者

URL Slugs: Redirects or 404s?

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 ...

-or-

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜