<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
#---------------if your are business because i get your logo website---------------------------#
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?exemple.gtld [NC]
#---------------CDN---------------------------#
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?cloudflare.com [NC]
#------------------search engine------------------------#
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?yandex.ru [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?yandex.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?yahoo.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?bing.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?baidu.com [NC]
#--------------Social networks----------------------------#
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?facebook.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?twitter.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?linkedin.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?viadeo.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?delicious.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?stumbledupon.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?pinterest.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?tumblr.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?foursquare.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?tumblr.com [NC]
#-----------------Radio online-------------------------#
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?tunein.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?shoutcast.com [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteCond %{HTTP_REFERER} !google\.
RewriteRule \.(gif|jpe?g?|png|bmp|avi|mp4|flv|pls|m3u|asx|xspf|qtl)$ http://www.yourdomainname.tld/blocked.jpg [NC,R,L]
</IfModule>
Or the alternative with htaccess (apache)
Code:<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ #---------------if your are business because i get your logo website---------------------------# RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?exemple.gtld [NC] #---------------CDN---------------------------# RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?cloudflare.com [NC] #------------------search engine------------------------# RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?yandex.ru [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?yandex.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?yahoo.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?bing.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?baidu.com [NC] #--------------Social networks----------------------------# RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?facebook.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?twitter.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?linkedin.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?viadeo.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?delicious.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?stumbledupon.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?pinterest.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?tumblr.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?foursquare.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?tumblr.com [NC] #-----------------Radio online-------------------------# RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?tunein.com [NC] RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?shoutcast.com [NC] RewriteCond %{HTTP_REFERER} !search\?q=cache [NC] RewriteCond %{HTTP_REFERER} !google\. RewriteRule \.(gif|jpe?g?|png|bmp|avi|mp4|flv|pls|m3u|asx|xspf|qtl)$ http://www.yourdomainname.tld/blocked.jpg [NC,R,L] </IfModule>
if ($http_referer !~ "^$"){
set $rule_0 1$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?exemple.gtld"){
set $rule_0 2$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?cloudflare.com"){
set $rule_0 3$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?yandex.ru"){
set $rule_0 4$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?yandex.com"){
set $rule_0 5$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?yahoo.com"){
set $rule_0 6$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?bing.com"){
set $rule_0 7$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?baidu.com"){
set $rule_0 8$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?facebook.com"){
set $rule_0 9$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?twitter.com"){
set $rule_0 10$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?linkedin.com"){
set $rule_0 11$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?viadeo.com"){
set $rule_0 12$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?delicious.com"){
set $rule_0 13$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?stumbledupon.com"){
set $rule_0 14$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?pinterest.com"){
set $rule_0 15$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?tumblr.com"){
set $rule_0 16$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?foursquare.com"){
set $rule_0 17$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?tumblr.com"){
set $rule_0 18$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?tunein.com"){
set $rule_0 19$rule_0;
}
if ($http_referer !~* "^https?://([^.]+\.)?shoutcast.com"){
set $rule_0 20$rule_0;
}
if ($http_referer !~* "search\?q=cache"){
set $rule_0 21$rule_0;
}
if ($http_referer !~ "google\."){
set $rule_0 22$rule_0;
}
if ($rule_0 = "22212019181716151413121110987654321"){
rewrite /\.(gif|jpe?g?|png|bmp|avi|mp4|flv|pls|m3u|asx|xspf|qtl)$ http://www.yourdomainname.tld/blocked.jpg redirect;
}