Protect hotlinking the right way. There are content stealers out there who will copy your links and images and display them at their websites in result of which you pay more for bandwidth. If you do not do it the right way, you can block google and feedburner also. Here is a code to do it the right way. Any incoming direct request for your image file, zip file or rar will will display your specified image instead of that.

Add this code into your .htaccess file and make sure you change ‘yoursitename’ there.

Options +FollowSymlinks
# Protect Hotlinking
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+.)?yoursitename.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?google.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?feedburner.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?feeds2.feedburner.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*.(jpe?g|gif|bmp|png|zip|rar)$ http://yoursitename.com/someimage.jpg [L]
  • Share/Bookmark

, ,

4 Reviews

  1. [...] Protect Hotlink the Right Way Using htaccess – htaccess – PHP … By admin | category: free scripts, scripts | tags: downloads, hotlink-the-right, magic, [...]

  2. iphone konig says:

    thanks for this – happy holidays :D

  3. iphonekönig says:

    happy new year – love your blog

  4. Nick Matyas says:

    this is an outstanding blog
    the way u write is fabolous.
    Thanks a lot

Leave a Review