私は写真のウェブサイトを立ち上げるところです、そして私の画像にいくらかの保護を与えたいです。ウェブで検索した結果、次のようになりました。
#Set FollowSymLinks, in most cases already set on the server
Options +FollowSymLinks
#Enable Indexes
Options +Indexes
#Turn on the Rewrite Engine
RewriteEngine on
#Allow my domain
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?mydomain.com [NC]
#Allow another domain
#RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?anotherdomain.com [NC]
#Allow blank referrers or delete this line to block them
#Deleting this line also blocks access to images by filepaths
RewriteCond %{HTTP_REFERER} !^$
#Allow search engines
RewriteCond %{HTTP_REFERER} !google. [NC]
RewriteCond %{HTTP_REFERER} !search?q=cache [NC]
RewriteCond %{HTTP_REFERER} !msn. [NC]
RewriteCond %{HTTP_REFERER} !yahoo. [NC]
#File types to be blocked
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
#OR
#First allow an image to be hotlinked to avoid looping
#RewriteCond %{REQUEST_URI} !^mydomain.com/image/hotlinker.gif$
#Then display it as a custom image
#RewriteRule .(jpg|jpeg|png|gif)$ mydomain.com/image/hotlinker.gif [NC,R,L]
1)空白のリファラーをブロックすることなく、ファイルパスの入力によって画像が呼び出されるのを防ぐ方法はありますか?これを実行したい場合がいくつかありますが、サイト全体ではありません。
2)Google、MSN、Yahooが自分の画像に適切にアクセスできるようにするための正しいコードがありますか?
3)私が持っているコードは複数のソースからマージされています。構文の知識がないので、代替画像のない最初のRewriteRuleだけが\で始まり、2番目の画像ではないのはなぜだろうか。
フィードバックに感謝します、ありがとう。