问题原文
原帖链接 · GeniusDesign · CC BY-SA 3.0
Say I have a web shop with a product (optimus-prime), in a category (superheros) such that it has the URL:
www.example.com/superheroes/optimus-prime
Now I want to prepend the product ID (99) to the product name in the URL, so that the URL becomes:
www.example.com/superheroes/99-optimus-prime
In regards to SEO, specifically Google search rankings, does it make any notable difference when using one product URL over the other?
As a programmer, I prefer using the URL with the ID in it because it makes system alias generation 100% fail safe for CMS routing purposes.
已采纳解答
原帖链接 · Will Crawford · CC BY-SA 3.0
How
- Include the id in a sensible place. Easiest is have .../product/$id/name-of-product etc.
- works with pretty much every routing system, no regexes
- Add a <link rel=canonical> (or however you spell it, it’s a while since I had to do this) to a url with just the id ¹
- When handling requests, if the url doesn't have the correct text then do a redirect to the url with the current correct text in.
Why
When you (inevitably) have to change the text for some product:
- Google will see old and new versions as the same page / entity / product
- old uncorrected links will still “work” (and be redirected to new ones)
- this applies to incoming links from other sites, too, so you don’t lose your “Google sauce” (or whatever the cool kids are calling it these days)
- When (almost inevitably) you have multiple products with the same name (especially if you have a popular item that gets “updated” or “restyled” etc.) but different IDs, both can have a link that works (might help you sell off the old stock)
- you can always add a link to the “new” product on the “old” one’s page
Typoes are inevətəble. If they want to count on keeping product names unique, and never having them corrupted by double-UTF8-encoding or whatever, tell them they get to keep both pieces. Including going through the 404s in the webmaster tools …
¹ This isn’t essential, since a link with the “wrong” text in will redirect anyway. As long as it does have the id in it, it’s more-or-less unbreakable.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
