How to prevent downloading and leeching media files

How Do I Stop Hotlinking, Bandwidth Theft, Downloading and Leeching media files?

You can stop downloading / hotlinking / leeching your site’s files using .htaccess in your Apache root or directory. The Apache mod_rewrite must be enabled for this.

The 1st line of the above code begins the rewrite. The 2nd line matches any requests from svnlabs.com url. The [NC] code means “No Case”, meaning match the url is not case sensitive. The last line matches any files ending with the extension pdf|zip|gif|jpg|dmg|flv|mp4|mp3|rar have blocked access or 403 error.

Please find more media file extensions here…

You can see access is blocked for some files other are showing here….

Files on FTP….

Here is demo for JWPlayer…

Even you can download files any case you can play that file because it content below code 😉

We you try to download media file it will show following access error…

You can block some traffic using server’s firewalls 😉

Check your URL, if you see your media load, your media can be hotlinked.

There are actually quite a few reasons to use .htaccess

1. Make URLs cleaner and easier to remember for visitors.
2. Make dynamic pages appear as static for SEO.
3. Security / Protection for PHP sites.
4. Sub-Domain managements……

Demo: How to protect file leeching

The best and most practical way to stop theft is to use a streaming server like Red5, Wowza, FMS etc. HTTP Streaming is very insecure but RTMP / RTSP are best on streaming server 😉

Time is nature’s way of making sure that everything doesn’t happen at once. Space is nature’s way of making sure that everything doesn’t happen to you.