问题原文
原帖链接 · Hooman Bahreini · CC BY-SA 4.0
In e-commerce websites, we want to include product title in the URL for SEO benefit... however the title is not unique so we generally include an id along with the title.
The title is determined by the user, so they may change it to anything they want...
This is exactly the same situation that happens in stackoverflow, as descrived below:
The question link structure on stackoverflow is:
https://stackoverflow.com/questions/id/comma-separated-title
The correct URL:
https://stackoverflow.com/questions/73793686/building-a-custom-canonical-url-in-python
If I change the URL to:
https://stackoverflow.com/questions/73793686/building-a-custom-canonical-url-in-python-java
I will get a permanent redirect to the correct link.
Now I go ahead and change the question title in stackoverflow:
This time if I send a request for:
https://stackoverflow.com/questions/73793686/building-a-custom-canonical-url-in-python
I will get redirected to:
https://stackoverflow.com/questions/73793686/building-a-custom-canonical-url-in-python-java
I want to follow the above approach in my e-commerce website (for SEO purposes) however I am not sure if there is any issue with having circular permanent redirects, like above?
How is it circular?
Originally I told Search engines
.../building-a-custom-canonical-url-in-python
should be redirected to:
.../building-a-custom-canonical-url-in-python-java
Now I am telling the search engines that:
.../building-a-custom-canonical-url-in-python-java
should be redirected to:
.../building-a-custom-canonical-url-in-python
So if the router/search engine/browser remembers my instruction, this could end up in an infinite loop... it practice it does not.
But is there any issue with the above approach? One can argue that we are misguiding the routers by giving them contradictory instructions.
已采纳解答
原帖链接 · Maximillian Laumeister · CC BY-SA 4.0
BNazaruk's answer covers the SEO side of things; I want to address the browser side.
When web browsers sense that their cached 301 would cause a circular redirect, they invalidate their cache and re-fetch the redirected URL anew. So, cached redirects cannot cause circular redirection in modern mainstream web browsers.
Basically, not only is there no SEO issue with the redirect pattern you described, but there's no browser issue either. It's a perfectly fine pattern to use.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
