smaller reset larger         

Main Menu

All times are in GMT -7 (DST) :: The time is now 11:21 pm.

Sub Menu

Article Data
Article Ref
9057-WUSX-3808
Date Created
Mon, 10th Mar 2003
Date Modified
Wed, 4th Jun 2014
 
(Lost?)

   Prevent Hotlinking of Files

Question 

How do I prevent others from directly linking to, or "hotlinking" files and other resources present on my site?

Answer 

It is sometimes useful to prevent others from linking directly to pages or files contained within your site. You may, for example, want users to enter through your index page to see important announcements.
To enable this restriction, create an .htaccess file with the following contents in the directory you wish to protect:

AuthUserFile /dev/null
AuthGroupFile /dev/null
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/
RewriteCond %{HTTP_REFERER} !^http://domain.com/
RewriteCond %{HTTP_REFERER} !^http://www.otherdomain.com/
RewriteRule /* http://www.domain.com/index.html [R,L]

...where domain.com is your domain name, and http://www.otherdomain.com is another site you wish to except from the linking restriction. (You may duplicate this line to add other sites.)

Article Comments 

There are currently no comments.