如何最好地从一个在 Google 上索引了许多重复条目的旧网站设置 301 重定向?
我目前正在与客户合作重新开发他们的网站。在启动之前我需要做的最后一件事是确保旧网站的页面正确重定向到新网站的新 URL 结构。
不幸的是,当我检查 Google 查看他们当前网站的索引情况时,发现这个相对较小的网站似乎有超过 1500 个页面被索引。
当我查看 Google 上的索引链接时,许多似乎是同一页面的重复项,但由于旧网站上使用的糟糕的 URI 结构,Google 会以不同的方式对待它们。
例如,“地图”页面在 Google 上至少被索引两次,位于以下 2 个 URL 下:
www.website.com/frame_page-map.html?mp_session=iris7k85851j05q55piqci31u3&mp_session=iris7k85851j05q55piqci31u3?page_code=map&mp_session=iris7k85851j05q55piqci31u3&mp_session=iris7k85851j05q55piqci31u3
www.website.com/frame_page-map.html?mp_session=sel6m8j5cu8lulep4dqa32sne7&mp_session=sel6m8j5cu8lulep4dqa32sne7?page_code=map&mp_session=sel6m8j5cu8lulep4dqa32sne7&mp_session=sel6m8j5cu8lulep4dqa32sne7
URL 中只有会话名称不同(而且我也不知道为什么它在单个 URL 中重复四次) 。
作为参考,此页面的替换网址为:
www.website.com/contact/map
我的问题是:如何为 Google 上的这些多条记录设置重定向?我是否只需为旧 URL 设置重定向,减去所有 URI 参数(即 www.website.com/frame_page-map.html),还是有其他更好的方法来执行此操作?
感谢您提供的任何帮助!
I am currently working with a client to redevelop their website. One of the final things I need to do before launch, is to make sure that their old website's pages are correctly redirected to the new URL structure of the new website.
Unfortunately, when I check Google to see how their current site is indexed, this relatively small website appears to have over 1500 pages indexed.
When I look at the indexed links on Google, many appear to be duplicates of the same page, but because of the terrible URI structure used on the old website, Google treats them differently.
For example, the 'Map' page is indexed at least twice on Google, under the following 2 URLs:
www.website.com/frame_page-map.html?mp_session=iris7k85851j05q55piqci31u3&mp_session=iris7k85851j05q55piqci31u3?page_code=map&mp_session=iris7k85851j05q55piqci31u3&mp_session=iris7k85851j05q55piqci31u3
www.website.com/frame_page-map.html?mp_session=sel6m8j5cu8lulep4dqa32sne7&mp_session=sel6m8j5cu8lulep4dqa32sne7?page_code=map&mp_session=sel6m8j5cu8lulep4dqa32sne7&mp_session=sel6m8j5cu8lulep4dqa32sne7
Only the session name is different in the URL (and I have no idea why it is repeated four times in a single URL, either).
For reference, the replacement URL for this page is:
www.website.com/contact/map
My question is: How do I setup a redirect for these multiple records on Google? Do I simply set-up the redirect for the old URL minus all of the URI parameters (i.e. www.website.com/frame_page-map.html) or is there another better method to do this?
Thanks for any help you might be able to offer!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您的目标是什么。如果您不关心查询字符串,则设置一个仅指向您的根页面 - map.html 的 301(永久重定向)。为了防止谷歌将查询字符串参数索引为单独的页面,请使用规范标签并让它引用父级。这不能保证有效,但谷歌在索引时会考虑您的规范。
如果您关心查询字符串值,那么您将必须为每个值设置一个重定向。您可以将一个查询字符串参数附加到重定向中,该参数将告诉它被忽略,这样您就不必编写检测它的正则表达式。
It depends on what your goals are. If you don't care about the querystrings then setup a 301 (permanent redirect) that points to just your root page - map.html. To prevent google from indexing querystring params as separate pages use the canonical tag and have it reference the parent. This isn't guaranteed to work, but google takes your canonical into consideration when indexing.
If you care about the querystring values then you will have to setup a redirect for each one. There is a querystring parameter that you can append to your redirects that will tell it to be ignored so you don't have to write a regex that detects it.