Hotlinking is a technique that is frowned upon on the Internet. This happens if you upload a file to your webserver and someone else links to that file directly effectively using your bandwidth to display and / or spread the file on his website. This happens most often with images but it could also be happening with all other files such as zip or pdf.
The best way to stop someone hotlinking your files is to setup a htaccess file a directory that you want to protect. All subdirectories are protected as well by this. If you use a webhosting account you should make sure that you can actually use .htaccess files on it before you try and implement this feature.
To use them you simply upload a file called .htaccess to a directory on your website and edit it with the following information to prevent hotlinking:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?ghacks.net [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
You have to edit the domain name of course and add possible other filetypes to the list in the fourth line. If you have another domain that should be allowed to hotlink your files you simply add the third line again and edit the domain name accordingly.
If you have a Wordpress blog and can’t use .htaccess you could use the Wordpress plugin called Hotlink Protection which basically does the same thing but does not allow the addition of other domain names.
Related posts:
Secure your server with htaccessHow to create your own blog with domain Part 2
FTP Server Setup
Wordpress 2.5.1 released
An alternative to file hosts
A solution for visiting blocked contents
Wordpress Blogs: Create Custom Tag Pages
Wordpress Hack: Change Number Of Comments Per Page In Admin Interface
3 Responses to “How to setup Hotlink Protection”
Trackbacks/Pingbacks
-
[...] 原文链接。 I hope you enjoyed reading this post. You may now subscribe to my RSS Feed, scroll down to 留下评论 or get back to the homepage. I recommend Giganews, the ultimate P2P alternative: Read here why [...]


As long as only the owner site can access the file, nice piece of information.
African Boy that’s why the name of the site is mentioned in the code :P