Facebook评论没有选择正确的URL

时间:2011-09-27 23:37:11

标签: facebook comments

我正在使用Facebook评论并提供页面的网址来区分。这是我正在使用的代码

<?php $commenturl="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>

<div id="fb-root"></div>
<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="8" width="670"></fb:comments>

我的网址是www.domain.com/foldername/index.php?etc。

所以它显示评论Feed好了,但是一旦有人发表评论,他的墙上的网址就会省略foldername并直接转到mangoestv.com/index.php?etc。

我该怎么做?

1 个答案:

答案 0 :(得分:1)

我有同样的问题,解决方法是使用htaccess重写url,因为看来facebook认为domain.com/index.php?var=abc和domain.com/index.php?var=xyz相同< / p>

所以你应该有像domain.com/abc和domain.com/xyz

这样的网址

修改:

有关重写网址的信息

http://www.workingwith.me.uk/articles/scripting/mod_rewrite

http://corz.org/serv/tricks/htaccess2.php

相关问题