我已经保护了用于热链接的图像,但我不能授权访问facebook机器人。我的htaccess中的配置是:
#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]问题是,当我试图将用户代理限制到facebook时,这不起作用,并且开放图形api可以获得图像。谢谢!
发布于 2017-12-15 03:14:34
尝试将RewriteCond %{HTTP_USER_AGENT}行更改为:
RewriteCond %{HTTP_USER_AGENT} !(?:facebookexternalhit|Facebot) [NC]https://stackoverflow.com/questions/47819078
复制相似问题