Preventing hot linking of images

This item was filled under [ Web Server ]

Thanks for visiting! If you're new here, you may want to subscribe to my Rss Feed. This blog posts regular Internet news, updates for apps, security, ideas, hacks, quick fixes and everything about hi-tech. Go ahead, Subscribe to our Feed or Register for Free!

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

Popularity: 319 reading
Tagged with: [ , ]
If you like this entry, consider bookmarking or help us promote it. Thank You!
Interesting Articles:

Related post to "Preventing hot linking of images"

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Comment