Förhindra bild Hotlinking - CSS-tricks

Anonim
RewriteEngine On RewriteCond %(HTTP_REFERER) !^http://(.+\.)?yourdomain\.com/ (NC) RewriteCond %(HTTP_REFERER) !^$ RewriteRule .*\.(jpg.webp|gif|bmp.webp|png)$ /images/dontsteal.jpg.webp (L)

Bilder som länkar till var som helst annars än din webbplats omdirigeras till en anpassad grafik. Observera dock att detta också påverkar personer som läser inlägg via RSS-läsare.

Tillåt också sökmotorer

RewriteCond %(HTTP_REFERER) !^http://(.+\.)?mydomain\.com/ (NC) RewriteCond %(HTTP_REFERER) !^http://(.+\.)?google\.(.+)/ (NC) RewriteCond %(HTTP_REFERER) !^http://(.+\.)?(.*\.)?google\.(.+)/ (NC) RewriteCond %(HTTP_REFERER) !^http://(.+\.)?bing\.(.+)/ (NC) RewriteCond %(HTTP_REFERER) !^http://(.+\.)?(.*\.)?bing\.(.+)/ (NC) RewriteCond %(HTTP_REFERER) !^http://(.+\.)?yahoo\.(.+)/ (NC) RewriteCond %(HTTP_REFERER) !^http://(.+\.)?(.*\.)?yahoo\.(.+)/ (NC) RewriteCond %(HTTP_REFERER) !^$ RewriteRule .*\.(jpe?g|gif|png)$ /transparent.gif (L)