开发者

.htacess Redirect & Secure Browsing on my Facebook Page

I use the following Code on my Facebook page to check if user is FAN or NOT FAN. After this the users get different contents. It works fine but if I use Secure Browsing in Facebook I always see just: "You don't like this page yet."

<?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/开发者_如何学Cxhtml1/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>

I found the problem: It's because of this in my .htaccess Do you know if there is a way to solve this problem without to remove the following code, because it's good for SEO?

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


You are losing the signed_request when doing the redirect, so $like_status will always be false. You need to change your htaccess. Maybe this answer will help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜