Pages Menu
TwitterFacebookRss
Categories Menu

Posted by on Apr 19, 2012 in Blog, Webdesign

How to Stop Image Hotlinking with .htaccess



Stop Image Hotlinking – we have a quick tip, that can help you protect your server bandwidth. So if you are in situation that you find your pictures on another server, you can block this unwanted load.. and be happy again about your content, check this tips..

Stop Hotlinking with htaccess. Test your Image Hotlink Protection with our Hotlink Checker from altlab.com. – Would you like to stop hotlinkers? Is your web hosting bandwidth bill growing each month? No budget in getting a dedicated server? Want to test image hotlink protection for your web site? Here is information on using an htaccess file to stop hotlinking and bandwidth theft.

Example: Your site url is www.mysite.com. To stop image hotlinking from other sites and display a replacement image called qX4w7.gif from an image host, place this code in your .htaccess file:

RewriteEngine On
 RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
 RewriteCond %{HTTP_REFERER} !^$
 RewriteRule .*\.(jpe?g|gif|bmp|png)$ http://i.imgur.com/qX4w7.gif [L]

To stop hotlinking from specific outside domains only, such as myspace.com, blogspot.com and livejournal.com, but allow any other web site to hotlink images:

RewriteEngine On
 RewriteCond %{HTTP_REFERER} ^http://(.+\.)?myspace\.com/ [NC,OR]
 RewriteCond %{HTTP_REFERER} ^http://(.+\.)?blogspot\.com/ [NC,OR]
 RewriteCond %{HTTP_REFERER} ^http://(.+\.)?livejournal\.com/ [NC]
 RewriteRule .*\.(jpe?g|gif|bmp|png)$ http://i.imgur.com/qX4w7.gif [L]

You can display a 403 Forbidden error code instead of an image. Replace the last line of the previous examples with this line:

RewriteRule .*\.(jpe?g|gif|bmp|png)$ - [F]

Test Image Hotlinking Protection
Stop Hotlinking and Bandwidth Theft. Test your Hotlinking Protection with our Hotlink Checker.


Tags:

Do you like this post? Get more with our Newsletter!!!

We provide great tips, tricks, and strategies a few times a month. Hope you get some value out of it! It's where ALL of our best posts go!!! We hate Spam!!!
Newsletter
 

Stay with us, we have a more cool Related Posts:

0 Comments

Trackbacks/Pingbacks

  1. Tweet-Parade (no.16 April 2012) | gonzoblog.nl - [...] How to Stop Image Hotlinking with .htaccess - Today we have a quick tip, that can help you protect your ...
  2. Tweet Heat - The hottest Tweets of the Month [April 2012] | Inspired Magazine - [...] How to Stop Image Hotlinking with .htaccess - Today we have a quick tip, that can help you protect your server ...
  3. Tweet Heat – The hottest Tweets of the Month [April 2012] « iTechTunes - [...] How to Stop Image Hotlinking with .htaccess - Today we have a quick tip, that can help you protect your server ...
  4. Tweet Heat – The hottest Tweets of the Month [April 2012] | Web design blog - [...] How to Stop Image Hotlinking with .htaccess - Today we have a quick tip, that can help you protect your server ...