我正在尝试对我的图像实施一些保护,我的代码有什么问题?
// If referral is from google but NOT from "http://www.google.com/blank.html", redirect home
RewriteCond %{HTTP_USER_AGENT} !(googlebot|bingbot|Baiduspider) [NC] //If user agent is NOT bot
RewriteCond %{HTTP_REFERER} !^$ //Allow blank referral
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC] //if referral is from google
RewriteCond %{HTTP_REFERER} ^http://www.google.com/blank.html$ //if referral is NOT from that url
RewriteRule http://www.mydomain.com/ [R,L] //redirect home
// If referral is from my domain and accessing images, do nothing
RewriteCond %{HTTP_USER_AGENT} !(googlebot|bingbot|Baiduspider) [NC] //If user agent isn't bot
RewriteCond %{HTTP_REFERER} !^$ //Allow blank referral
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain.com [NC] //if referral is from my domain
RewriteCond %{REQUEST_URI} !(^|&)images(&|$) //if URL contains string "images"
RewriteRule ^.*$ - [NC,L] // DO nothing
// If referral is NOT from my domain and accessing images, show watermarked image
RewriteCond %{HTTP_USER_AGENT} !(googlebot|bingbot|Baiduspider) [NC] //If user agent isn't bot
RewriteCond %{HTTP_REFERER} !^$ //Allow blank referral
RewriteCond %{HTTP_REFERER} mydomain.com //if referral is NOT from my domain
RewriteCond %{REQUEST_URI} !(^|&)images(&|$) //if URL contains string "images"
RewriteRule ^images/(.*)$ http://www.mydomain.com/cache/$1 [NC,R,L] //redirect to watermarked image
我非常想创建这个答案的第 2 步,但是我遇到了“等于”和“不等于”的问题,因为我来自 php 和!运算符用于不等于。
帮助别人?