Я пытаюсь реализовать некоторую защиту своих изображений, что не так с моим кодом?Как реализовать .htaccess hotlink protection
// 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 из this answer, но у меня возникают проблемы с «равно» и «не равно», как я из PHP и! оператор используется для Не равный.
Помогите кому-нибудь?