사진 웹 사이트를 시작하는 데 거의 다르고 내 이미지를 보호하고 싶습니다.이미지 보호를 위해 htaccess 사용
#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이 두 번째가 아닌 \로 시작하는 이유는 무엇입니까?
의견을 보내 주셔서 감사합니다.
감사합니다. Jon에게 도움을 주신 데, 고맙습니다. 나는 내 질문에 대한 대답으로 좀 더 게시했다. – martin
내 자신의 질문에 대답하여 올바른 프로토콜을 따르지 않았다면 사과드립니다. 내가 어떻게 코멘트에 모두 들어갈 수 있는지는 몰랐다. – martin
HTTP_REFERRER에 의지하는 것이 안전합니까? – Geo