【问题标题】:href: Can I get Google search results to use/display the final redirect url?href:我可以让谷歌搜索结果使用/显示最终的重定向网址吗?
【发布时间】:2014-03-29 07:44:11
【问题描述】:

我的网站有使用以下格式的网页网址:

www.mysite.com/id/pretty_title

首页链接到这些页面,但href其实包含一些参数:

 www.mysite.com/id/?some_ugly_parameters_to_let_me_know_what_search_it_is_from

然后重定向到

www.mysite.com/id/pretty_title

显示页面。

我的问题是 Google 的搜索结果将指向页面的链接显示为丑陋的链接,而不是漂亮的重定向链接。除了看起来丑陋之外,它还可能导致错误,因为丑陋链接中包含的参数与直接从 Google 进入页面的用户无关。

我可以让 Google 只使用最终的重定向网址吗?或者以其他方式避免这个问题?我确实需要传递这些参数。无法在会话中存储信息,因为用户可以打开多个选项卡。

【问题讨论】:

    标签: html search href


    【解决方案1】:

    在“丑陋的 URL 页面”上,您输入了 <link rel="canonical" href="www.mysite.com/id/pretty_title">,它会告诉搜索引擎您对该内容的首选 URL。

    还可以将www.mysite.com/id/?some_ugly_parameters_to_let_me_know_what_search_it_is_from 设置为具有301 redirect 的漂亮网址

    规范网址:https://support.google.com/webmasters/answer/139066

    301 重定向:https://support.google.com/webmasters/answer/93633?hl=en

    【讨论】:

    • “丑陋的 url 页面”实际上从未存在过,至少在我可以在此信息中写入的地方不存在。重定向是通过 Django 的 HttpResponseRedirect(pretty_url) 在内部完成的。所以我想我需要弄清楚 Django 如何添加规范的 url。谢谢!
    • 好的,所以我现在了解到,“丑陋的 URL 页面”与“漂亮的 url 页面”相同,因为它重定向到那里,所以这就是我放置规范 url 的地方。谢谢。
    猜你喜欢
    • 1970-01-01
    • 2014-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-07
    • 1970-01-01
    • 1970-01-01
    • 2012-07-12
    相关资源
    最近更新 更多