Leech stopper

software development


I have a rogue website that is leeching one of my videos, a wmv file.

There is a recipe for .htaccess that is alleged to stop leechers.

The recipe is:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://www.mydomin.com [NC,OR]
RewriteCond %{HTTP_REFERER} !^http://mydomain.com [NC]
RewriteRule [^/]+.(gif|jpg|wmv)$ - [NC,F,L]


Thanks DreamHost!


Does this stop leeching for the directory where the .htaccess file is located or for the entire site if placed in the root?


If you place this .htaccess file in the root, then it works for the entire site.

Try out DreamHost with a free WebID /// Compare plans


If you’re concerned about bandwidth, you should check out this neat app a friend and I wrote called “Teraband” – it dynamically limits bandwidth to give you much finer control over access to a file or sets of files. http://www.sf.net/projects/teraband

Ido (Donate!)


Just an update…

The recipe above did not stop the leaching of the .wmv and .mov files. To stop that, was a bit more complex, but just as successful.

You need two parts…
First you need to set a cookie in the html page that will be called sometime before your video is to be seen.
Second, you check for the cookie with the htaccess file.

This works best if the movies are all contained in one directory.

The javascript to set a cookie is:

The htaccess file looks like:

RewriteEngine on
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.$ [NC]
RewriteCond %{HTTP_COOKIE} !(^|(.+;)
RewriteRule /
$ http://www.mydomain.com [L,R]