Preventing bandwidth theft using .htaccess

While all HostRocket plans include plenty of bandwidth (transfer) nobody ever has enough available bandwidth to afford to have a substantial amount of bandwidth stolen out from under them unchecked due to the "hotlinking" of images. Hotlinking is when unscrupulous webmasters not only steal your images, but go so far as to use your bought and paid for bandwidth to steal the images over and over again by directly calling images on your account for use on their pages hosted elsewhere.

One can prevent this type of bandwidth theft via the use of mod_rewrite directives placed in .htaccess file(s). The following example should result in an inability to call .gif or .jpg image files from domains other than "domain.com" (which you would naturally modify to reflect your own domain name) without interfering with embedded .gif and .jpg image files on your own pages:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\\.)?domain.com/.*$ [NC]
RewriteRule \\.(gif|jpg)$ - [F]

  • 2 Користувачі, які знайшли це корисним
Ця відповідь Вам допомогла?

Схожі статті

How do I re-direct non-https traffic to the https version of the website?

With the latest cPanel version, there is a 'Force HTTPS Redirect' option in the 'Domains'...

How to create a user-friendly URL using .htaccess?

If your website is using a long URL like example.com/files/folder/sitemap.html, you can change it...

Setting a default index page using .htaccess

By default our servers will look for (in order) a file by the name of index.html, index.cgi,...

Redirection using .htaccess

Most websites are constantly changing "works in progress" and as one updates, rearranges and...

Enabling/disabling directory listings using .htaccess

By default when accessing any directory which does not contain an index file on a cPanel server...