Support Center » Knowledgebase » Unix Tips » Preventing Image Hot Linking

Preventing Image Hot Linking



If you have many images on your site, sometimes people can just insert them into their web sites by simply referring directly to your site.

This practice is often called "hot-linking".

You can prevent this on your Unix account (at the moment there is no known practical method to do this on Windows). This is done by inserting a couple of lines into a file called .htaccess

It is a text file containing the following lines:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]

You should replace yourdomain.com with your real domain name.

Upload the .htaccess file into the same directory as your normal index.html file. If you encounter any errors browsing your site after uploading this file, try to delete it.

Note that some FTP clients hide files starting with a period (such as .htaccess). There should be an option to show them. The option is sometimes called "Show hidden files".



Article Details
Article ID: 84
Created On: 16 Aug 2004 05:00 AM
 Back
 Login [Lost Password] 
Email:
Password:
Remember Me:
Please note that the login and password to the support area is NOT the same as your hosting control panel login and password
 
 Search
 Article Options
Home | Register | Submit a Ticket | Knowledgebase | Downloads | Control Panel User's Guide | Server Status
Language: