.htaccess Redirect&在我的Facebook页面上安全浏览

时间:2011-09-30 12:32:28

标签: php facebook

我在我的Facebook页面上使用以下代码来检查用户是FAN还是不风扇。在此之后,用户获得不同的内容。它工作正常,但如果我在Facebook中使用安全浏览,我总是看到:“你还不喜欢这个页面。”

<?php
require_once 'facebook-php-sdk/src/facebook.php';

// Create our Application instance.
$facebook = new Facebook(array(
  'appId' => 'X',
  'secret' => 'X',
  'cookie' => true,
));

$signed_request = $facebook->getSignedRequest();
$like_status = $signed_request["page"]["liked"];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>zukundo</title>
<link rel="stylesheet" href="css/blueprint/screen.css" type="text/css" media="screen, projection">
</head>

<body>
<?php 
if ($like_status) {
    echo "You like this page.";
} else {
    echo "You like this page not yet.";
  }
?>

</body>
</html>

我发现了问题:这是因为我的.htaccess 你知道如果有办法解决这个问题而不删除下面的代码,因为它对SEO有好处吗?

RewriteCond %{HTTP_HOST} ^page\.de
RewriteRule (.*) http://www.page.de/$1 [R=301,L]

1 个答案:

答案 0 :(得分:1)

您在执行重定向时丢失signed_request,因此$like_status始终为false。你需要改变你的htaccess。也许这answer会帮助你。

相关问题