gpt4 book ai didi

php - 如何让 Facebook Debugger 读取规范 URL?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:28:20 24 4
gpt4 key购买 nike

当我使用 Facebook 的 Open Graph Object Debugger 测试我的网站时,就会发生这种情况:

enter image description here

它不喜欢个人资料页面后面的尾随数字。但是我已经正确定义了这两个:

<meta property="og:url" content="http://www.website.com/profile/139">
<link rel="canonical" href="http://www.website.com/profile/139">

我已经尝试了几个小时,它一直重定向到主页:

enter image description here

我可以在我的 .htaccess 文件或 PHP header 中添加什么来防止此 301 重定向吗?

可能与 Facebook/Google 处理 URL 参数的方式有关:http://gohe.ro/1fpOA0N

最佳答案

anser 是我们的域名托管服务商 WP Engine 的一个问题,它会诱使蜘蛛程序忽略页面 URL 末尾的纯数字字符串。具体涉及:

  • Googlebot(Google 的蜘蛛)
  • 啜饮! (雅虎的蜘蛛)
  • BingBot(Bing 的蜘蛛)
  • Facebook 组织者/调试员

例如,以下网址:

http://www.website.com/profile/12345

将被解释为这些机器人:

http://www.website.com/profile

但是,如果字符串是非数字的,机器人将识别它。这样做是为了缓存目的。但同样,这仅适用于 WP Engine 和其他一些托管服务提供商。

关于php - 如何让 Facebook Debugger 读取规范 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21897848/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com