1

我正在运行一个托管在 Apache 和 Plone(基于 Zope)上的网站。我的问题是我有以下网址的重复内容:

www.site.com www.site.nl/en www.site.com/nl

以此类推,每个页面都显示相同的内容。

Google 网站管理员工具还会报告以下格式的网站重复:

www.site.nl/news www.site.nl/news/

注意尾部的斜杠。

解决此问题的最佳方法是什么(将 301 重定向到正确的 url)?我可以在 Plone 源中执行此操作吗?还是我应该使用规范标签?

问候

4

1 回答 1

2

Best place to solve it is in your apache configuration.

  1. Duplicate sites: choose one and permanently redirect the rest. For me, all www.reinout.vanrees.org traffic is redirected to reinout.vanrees.org.
  2. Trailing slashes: redirect URLs ending in / to their non-slash equivalents.

For (1), use this as an example:

<VirtualHost *>

ServerName www.reinout.vanrees.org

Redirect permanent / http://reinout.vanrees.org/

</VirtualHost>

For (2): you probably have big "virtualhostmonster" rewriterule at the end of your apache config. Copy/paste that line and use ^(.*)/$ instead of ^(.*) in the first one. That effectively strips trailing slashes.

于 2009-03-23T13:29:26.560 回答