Prevent Image Hotlinking


Tags:

Hotlinking equals to bandwidth stealing, if some one post the images on your server on their site they not only putting the images without permission, but they also steal and consume your bandwidth.

If you use Apache as your web server, you can simply overcome this image hotlinking problem. Just put this code in your .htaccess file, if you don't have one just create a file named .htaccess on the root directory of your site.

  1. RewriteEngine on<br />
  2. RewriteCond %{HTTP_REFERER} !^$<br />
  3. RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]<br />
  4. RewriteRule \.(gif|jpg|js|css)$ - [F]

Replace the "mydomain.com" with your own domain name. With this code, evertime someone place your images on their site, they won't see anything and the images won't be loaded.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.