Preventing hot linking of images

To stop people from using your images on their site while the image is still on your site (stealing valuable bandwidth), add the following to the . htaccess file:

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


Replace mydomain.com with your domain name and the gif|jpg with any other file extension, such as gif|jpg|swf

ads
Get our hottest stories to your inbox.
Check your inbox for a confirmation email.

Have something to add to this story? Share it in the comments.

Have something to add to this story? Share it in the comments.

Leave a Reply

Your email address will not be published.