Plone CMS (Zope) 中的 301 重定向

发布于 2024-07-15 10:03:34 字数 351 浏览 4 评论 0原文

我正在运行一个托管在 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 源中执行此操作吗? 或者我应该使用规范标签?

问候

I'm running a website hosted on Apache and Plone (based on Zope). My problem is that i have duplicate content with following urls:

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

and so on, every page shows the same content.

Google Webmaster Tools also reports sites in the following format to be duplicate:

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

Notice the trailing slash.

What's the best way to solve this (make a 301 redirect to the proper url)? Can i do this in the Plone source? Or should i use the canonical tag?

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青巷忧颜 2024-07-22 10:03:34

解决这个问题的最佳位置是在你的 apache 配置中。

  1. 重复站点:选择一个并永久重定向其余站点。 对我来说,所有 www.reinout.vanrees.org 流量都被重定向到reinout.vanrees.org。
  2. 尾部斜杠:将以 / 结尾的 URL 重定向到其非斜杠等效项。

对于 (1),以此为例:

ServerName www.reinout.vanrees.org

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

对于 (2):您的 apache 配置末尾可能有大的“virtualhostmonster”重写规则。 复制/粘贴该行并在第一行中使用 ^(.*)/$ 而不是 ^(.*) 。 这有效地去除了尾随斜杠。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文