2014-03-27 71 views
0

我運行這個網站www.miswag.net這是高度依賴於Facbeook。當我分享我在Facebook上的網站,我得到一個「403禁止」,這裏是Facebook的調試器輸出,當我嘗試刮我的網站:https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.miswag.netFacebook不能正確地刮我的網站 - PHP網站

請幫忙想出解決辦法..謝謝

+0

確保Facebook的刮板劑是白色的上市 –

+0

我發現這在我的Apache的訪問日誌:GET/HTTP/1.1" 404 - 「 - 」「facebookexternalhit/1.1(+ http://www.facebook.com/externalhit_uatext.php)。爲什麼說404?看起來Facebook正試圖訪問我在網站開發過程中用來保留的index.html,現在它已被刪除。 @AdamAzad ..謝謝 – Ammar

+0

如果(in_array($ _ SERVER ['HTTP_USER_AGENT'],array( 'facebookexternalhit/1.1(+ https)')你可以檢查代理是否有'facebookexternalhit/1.1'並返回一個自定義頭部://www.facebook.com/externalhit_uatext.php)', 'facebookexternalhit/1.1(+ http://www.facebook.com/externalhit_uatext.php)' ))){ header(「HTTP/1.0 404未找到」); } else { echo「You're not Facebook agent'__'」; }' 來源:http://stackoverflow.com/a/8626828 –

回答

0

Facebook的刮板不需要閱讀整個頁面,所以他們只需要發送一個Range頭部來請求它的一部分。但是,您的服務器似乎對該請求的響應不正確,並返回403錯誤代碼。您需要檢查您的服務器並確保它正確處理範圍標題。

要看到這個動作,試試這個curl命令:

curl -H "Range: bytes=0-524287" http://www.miswag.net 

這是我得到的迴應:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 
<html><head> 
<title>403 Forbidden</title> 
</head><body> 
<h1>Forbidden</h1> 
<p>You don't have permission to access/
on this server.</p> 
<p>Additionally, a 404 Not Found 
error was encountered while trying to use an ErrorDocument to handle the request.</p> 
</body></html> 
+0

問題是我在一個共享主機!我正在看着我的WHM,看起來我不能走那麼遠。我想我需要考慮找一個vps或其他東西 – Ammar

0

複利上@ Waleed'sanswer,如果你想馬上測試使用Online CURL

  1. 填寫www.wiswag.net
  2. ADD OPTION選項,選擇--header (-H)
  3. 旁邊"Range: bytes=0-524287"
  4. CURL按鈕