How to prevent content & bandwidth theft using htaccess? Print

  • 2

When you have a decent website with your own articles, images, media contents, clip arts etc. There are chances, other bloggers, website owners tend to use your media files & embed them using your own website link in the embed code which causes more bandwidth usage for your server & a theft of content. In order to disallow other website users not use media files using your domain, you can use following .htaccess code & block such requests.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
RewriteRule \.(gif|jpg|css)$ - [F]
Also, you can use another code to show their visitors that, the files are yours and being served without authentication by uploading an image saying so & adding following code to your .htaccess:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://www.yourdomain.com/hotlink.jpg [R,L]
Note: Make sure to change domain name, file name matching to your own domain name.

Was this answer helpful?

« Back

Powered by WHMCompleteSolution