开发者

URL Slugs: Redirects or 404s?

开发者 https://www.devze.com 2022-12-24 09:29 出处:网络
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\'...

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

精彩评论

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