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.
Related posts:
6 Responses
Comment by Motti
January 21, 2011 at 10:59 pm
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
Comment by George
January 26, 2011 at 2:14 am
This seems to be working for my site…is there any other code present on the file…
Pingback by Tweets that mention How to Disable Hot Linking : Online Marketing Blog -- Topsy.com
January 26, 2011 at 3:51 am
[...] This post was mentioned on Twitter by Pramit J Nathan, Social Harbour. Social Harbour said: How to Disable Hot Linking – http://goo.gl/5xyDP [...]
Comment by Alok
January 26, 2011 at 5:15 am
Code is good but i think this will remove image from images/pdf files from search engine. What you think George?
Comment by Maria
March 6, 2011 at 12:19 pm
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!
Pingback by How to Disable Hot Linking to Images « Maria's Guides
March 6, 2011 at 4:11 pm
[...] The one that I wound up using as a basis for my final code (shown below) can be found at “How to Disable Hot Linking” on the Online Marketing [...]
RSS feed for comments on this post · TrackBack URI