【问题标题】:Domain redirection and url masking域重定向和 url 屏蔽
【发布时间】:2018-04-19 18:39:50
【问题描述】:

上传的图片显示了facebook的帖子预览缩略图。

(1)考虑一个链接 x.com/abc 被重定向到 y.com/xyz

(2)当链接 x.com/abc 在 facebook 上共享时,它的预览将从 y.com/xyz 获取。

(3) facebook 生成的预览缩略图包含域 y.com 而不是 x.com

(4)我们如何让预览缩略图显示x.com而不是目标网址y.com

Facebook 截图显示我分享的网址 hivirality.com/abhishek 被重定向到 citryxsolutions.in 但预览缩略图包含目标网址的域名,即 citryxsolutions.in。

解决问题的可能情况是什么。

【问题讨论】:

    标签: redirect url-rewriting url-routing url-redirection


    【解决方案1】:

    你可以这样做,但它有点棘手。而不是从x.com/abc 重定向到y.com/xyz 的301。您的服务器应该返回 HTML,它将通过 JS 重定向用户。这个 HTML 应该有 Facebook 正在解析的 Open Graph 标记。例如:

    <!doctype html>
    <html lang='en'>
        <head>
            <meta charset="utf-8" />
            <meta property="og:url" content="URL" />
            <meta property="og:title" content="TITLE" />
            <meta property="og:type" content="website" />
            <meta property="og:description" content="DESCRIPTION" />
            <meta property="og:image" content="IMAGE URL" />
        </head>
    
        <body>
            <script type="text/javascript">
                if("false" == "false") {
                    window.location = "DESTINATION URL";
                }
            </script>
        </body>
    </html>
    

    URLx.com/abc

    DESTINATION URLy.com/xyz

    您可以在 FB 调试器中查看 Facebook 对此有何反应(您也可以在此处清除缓存):https://developers.facebook.com/tools/debug/

    【讨论】:

      猜你喜欢
      • 2017-02-08
      • 1970-01-01
      • 2012-12-10
      • 2014-07-20
      • 1970-01-01
      • 2012-07-29
      • 1970-01-01
      • 1970-01-01
      • 2011-08-27
      相关资源
      最近更新 更多