我即将推出一个摄影网站,并希望为我的图像提供一些保护。我在网上搜索的结果如下:
#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 以 \ 而不是第二个开头?
感谢任何反馈,谢谢。