RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yourdomain\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpg|gif|bmp|png)$ /images/dontsteal.jpg [L]
Images linked to from anywhere else than your website are redirected to a custom graphic. Do note though, that this would affect people reading posts through RSS readers as well.
Also allow search engines
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]
This snippet is popular on the web. One copies it from the other one. First of all: It doesn’t work for most of the cases in general. Try it with Coldlink (http://coldlink.com/htm/tool.htm) and you will see the original image.
In special, it does not work because the dontsteal.jpg causes a paradoxon with the rewrite-rule.
The Problem is how to make WordPress don’t change the .HTAccess to the default every time…
After wp-installation, manage the htaccess files rights, so that wp can’t write into it. You can manually add the changes you need to afterwards. (Or copy paste from the admin, when the wp tells you that the htaccess is not writable)
Would this work for preventing people from downloading videos from your site?
Some issue …
If upper strings have rule RewriteBase /
We have small and angry internal error 500 on external queries.
Better way is