简体   繁体   English

CakePHP中相同内容的多个URL

[英]Multiple URLs for the same content in CakePHP

I Just started exploring CakePHP. 我刚刚开始探索CakePHP。 From what I have observed, In CakePHP, All of the following are the same. 根据我的观察,在CakePHP中,以下所有内容都是相同的。

Is this not considered duplicate content by the search engines? 搜索引擎是否将其视为重复内容?

If yes, how to fix this? 如果是,该如何解决?

They are only duplicate content if you link to them differently, thus making the different urls visible. 如果您以不同的方式链接到它们,则它们只是重复的内容,从而使不同的URL可见。 Usually, using cake's internal routing you can only get one of those three versions. 通常,使用cake的内部路由只能获得这三个版本之一。 Always. 总是。

But if someone would get hold of the wrong url and does link it from somewhere it might actually be followed by google and indexed wrongly. 但是,如果有人掌握了错误的网址并确实从某个地方链接了它,那么它实际上可能跟在google之后,并且索引错误。 So yes, there is a possibility. 是的,有可能。

So 所以

  • use htaccess to prevent the / (or vica versa) and 301 redirect to the other one 使用htaccess来防止/(或反之亦然)和301重定向到另一个
  • use canonical tag in your layout to always route to the correctly routed url - not matter what the full url including /index etc might currently look like). 在您的布局中使用规范标记,始终将其路由至正确路由的url-不管包括/ index等的完整url当前可能是什么样子)。

Details and code examples: http://www.dereuromark.de/2012/12/29/cakephp-and-seo/ 详细信息和代码示例: http : //www.dereuromark.de/2012/12/29/cakephp-and-seo/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM