2011-09-30 109 views
-1

我在我的Facebook頁面上使用以下代碼來檢查用戶是否是FAN或非FAN。在此之後,用戶獲得不同的內容。它工作正常,但如果我在Facebook中使用安全瀏覽功能,我總是會看到:「你不喜歡這個頁面。」.htacess在我的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 你知道,如果沒有解決,而不刪除下面的代碼這個問題的一種方式,因爲這是很好的搜索引擎優化?

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

[安全瀏覽不會在Facebook頁面上爲粉絲/非粉絲顯示不同內容](http://facebook.stackoverflow.com/questions/7609149/secure-browsing-dont-show-different -content-for-fans-non-fans-on-a-facebook-page) – bkaid

回答

1

做重定向時,你正在失去signed_request,所以$like_status永遠是false。你需要改變你的htaccess。也許這個answer會幫助你。

+0

是不是signed_request部分(。*)? – genesis

+0

我想它是通過POST發送的,如果我理解正確,'(。*)'將只處理查詢字符串(GET)的* visible * url。 – ifaour

+0

啊,這是R = 301,沒有看到。是不是通過GET發送signer_request? – genesis

相關問題