2017-12-14 17 views
0

私はすでにホットリンクの画像を保護していますが、Facebookのボットへのアクセスを許可することができます。私のhtaccessでの設定です:保護されたホットリンク画像でFacebookのボットアクセスを許可する方法

#Prevent hotlinking 
RewriteEngine on 
#allows you to specify which files this applies to 
RewriteCond %{REQUEST_FILENAME} \.(?:js|css|gif|png|jpg)$ 
#if the client's (server's) IP address is not this 
RewriteCond %{REMOTE_ADDR} !^0\.0\.0\.0$ 
RewriteCond %{HTTP_REFERER} !^http?://www\.my\.domains\.mx/ 
RewriteCond %{HTTP_USER_AGENT} !="facebookexternalhit/1.1|facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)|Facebot" 
# forbid access 
#RewriteRule .* - [F,L] 

まあproblesは、私はFacebookのにユーザーエージェントを制限しようとすると、これが動作しないで、オープングラフAPIは、画像を得ることができます。ありがとう!

+0

:!するRewriteCond%{HTTP_USER_AGENT} facebookexternalhit \/1 \ 0.1 \ \(\ +のhttp:\/\/WWW \ .facebook \ .com \/externalhit_uatext \ .php \) –

答えて

0

RewriteCond %{HTTP_USER_AGENT}ラインを変更しよう:これは誰かのためにusesfulある場合

RewriteCond %{HTTP_USER_AGENT} !(?:facebookexternalhit|Facebot) [NC] 
関連する問題