Knowledgebase: Cpanel Control Panel > Getting Started
How do I prevent others from hot linking my pictures or movies?
Posted by Administrator on 24 December 2009 10:48 PM
|
|
How do I prevent others from hot linking my pictures or movies? You need to create an .htaccess file in the 'public_html' directory that contains the following code: RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://YOUR_IP_ADDRESS/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://YOUR_FIRST_DOMAIN.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.YOUR_FIRST_DOMAIN.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://YOUR_SECOND_DOMAIN.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.YOUR_SECOND_DOMAIN.com/.*$ [NC] RewriteRule .*.(gif|GIF|jpg|JPG)$ - [F] For each domain that you have content, just add two lines to the .htaccess file like below: RewriteCond %{HTTP_REFERER} !^http://YOUR_SECOND_DOMAIN.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.YOUR_SECOND_DOMAIN.com/.*$ [NC] Just make sure the first two lines and the last line is always the same. You may also add more to the last line for any other file type that you would like to prevent from being hot-linked (mov, asx, mpg, etc), just follow the syntax above (mov|MOV|asx|ASX). OR: Easier method: 1. Login to Cpanel 2. Click 'Hotlink Protection' | |
|
Comments (0)