.htacess重定向&安全浏览我的Facebook页面 [英] .htacess Redirect & Secure Browsing on my Facebook Page

查看:133
本文介绍了.htacess重定向&安全浏览我的Facebook页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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/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有好处。

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]


推荐答案

在执行重定向时,您正在输入 signed_request ,所以 $ like_status 将永远是 false 。你需要改变你的htaccess。也许这个答案将帮助您。

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.

这篇关于.htacess重定向&amp;安全浏览我的Facebook页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆