【问题标题】:Problems with Facebook comment plugin when use htaccess使用 htaccess 时 Facebook 评论插件的问题
【发布时间】:2012-11-29 21:16:45
【问题描述】:

我的 PHP 站点中的 facebook 评论插件不理解 href 属性中的 URL 并显示 Warning: Link us unreachable. 我已经测试了一个不使用 .htaccess 的文件,它运行良好并且不会抛出任何错误或警告,但是当我在 href 上放置一个虚拟 URL 时。 Facebook 无法识别该网址。

这是我网站的代码:

    <script>(function(d, s, id) {

      var js, fjs = d.getElementsByTagName(s)[0];

      if (d.getElementById(id)) {return;}

      js = d.createElement(s); js.id = id;

      js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";

      fjs.parentNode.insertBefore(js, fjs);

    }(document, 'script', 'facebook-jssdk'));</script><fb:comments href="<?php echo $commenturl; ?>"  num_posts="10" width="700"></fb:comments>

这是我网站上的信息:

$commenturl = http://smashlix.com/battle/Ipad-or-Windows-8

.htaccess 内容:RewriteRule ^battle/(.*)$ ./index.php?view=bd&title=$1

请帮帮我!

【问题讨论】:

    标签: facebook mod-rewrite facebook-javascript-sdk


    【解决方案1】:

    您的服务器使用 302 和 Location 标头进行响应,但其中的标头无效,因为它不包含完全限定的 URL:http://web-sniffer.net/?url=http://smashlix.com/battle/Ipad-or-Windows-8

    RewriteRule ^battle/(.*)$ ./index.php?view=bd&title=$1
    

    为什么文件名前有./?那个 .htaccess 文件在哪里,RewriteBase 是什么?

    【讨论】:

    • 因为你刚开始用php编程,首先使用htaccess。请您为我解释更多。这是我的 htacess 文件:Options +FollowSymLinks RewriteEngine On DirectoryIndexcomingsoon.php RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^battle/(.*)$ ./index.php?view=bd&title=$1 如何在 facebook 评论中理解 href 上的虚拟 URL。请帮我 !非常感谢。
    猜你喜欢
    • 2019-03-16
    • 2013-06-06
    • 1970-01-01
    • 1970-01-01
    • 2012-10-11
    • 2011-09-28
    • 2012-04-09
    • 2016-04-07
    • 1970-01-01
    相关资源
    最近更新 更多