Hotlink Protection – Protect Your Images!

Here is a tip that you can save up your bandwidth usage. If you believe that other people is hotlinking your images. This option can be enabled in Cpanel under hotlink protection, but if you are an experienced webmaster and have a lot of entries in your .htaccess file you may want to edit your .htaccess manually to better organize your rules.

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://domain.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ – [F,NC]

You can add more HTTP_REFERRER for domains within your allowed list, for example another web site or your subdomain.

Include this in your images folder or any folder to ensure that your images are protected.

One thought to “Hotlink Protection – Protect Your Images!”

Leave a Reply

Your email address will not be published. Required fields are marked *