How to Disable Hot Linking

Hot linking is a topic that has been discussed in this blog and this is a situation which no webmaster would like to happen with their website. Hot linking clearly eats up the bandwidth of your website and thereby caused negative impact on the overall search engine performance of the website. Hot linking usually happens when large files are hosted on your website and other small websites want to take advantage of this without using their own bandwidth.
Hot linking can be disabled or prevented with the help of a .htacess file. By writing few simple lines of codes on the .htacess files you can prevent the unauthorized linking of the files from your website. You just need to upload the .htacess to the root of your website once your finish writing the code. If you want to prevent the hot linking of JPG, GIF and PNG files from your website, then the htacess syntax can be written as follows.

RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?yourwebsite.com/.*$ [NC]
RewriteRule .(jpg|gif|png)$ – [F]

By writing this code, you have prevented other sites from accessing your files. The only site that has access to your files is the website mentioned in the .htaccess file, i.e yourwebsite.com.

Comments

  1. Motti says

    Hi,

    Thank you for the code. However, when adding the code, my own domain cannot access the files either. Why is that?

    Thank you,
    Motti

  2. Alok says

    Code is good but i think this will remove image from images/pdf files from search engine. What you think George?

  3. Maria says

    Thanks very much for this. Although image hotlinking isn’t much of a problem on my site (at least I don’t think it is), I’m very concerned with hotlinking to PDF files. I’ve tweaked your settings to not only prevent PDFs from being hotlinked, but to display an error image that directs users to the source site.

    Thanks again for your help. I can’t write code, but I can tweak it!

Trackbacks

  1. […] This post was mentioned on Twitter by Pramit J Nathan, Social Harbour. Social Harbour said: How to Disable Hot Linking – http://goo.gl/5xyDP […]

Leave a Reply

Your email address will not be published. Required fields are marked *