Prevent other sites from displaying your images with .htaccess hotlink protection

I don’t care much about web hosting bandwidth because my blogs are hosted at HostMonster with unlimited bandwidth. The bandwidth counter was not performing properly since March 2010. And it just got fixed middle of the November. I discovered that is using around 6 GB data on daily basis. Wow… That’s a lot for a blog with around 700 visits and 4500 pageviews per day. Someone is stealing lots of bandwidth by displaying PrettyGirl2u’s photos on their sites.

By creating a .htaccess file for hotlink protection, you can stop people from displaying your images and pictures on their sites. Of course, it will stop images from displaying from FeedBurner email subscribers too. Therefore, I disabled it on PrettyGirl2u since it does not make any money for me. So everyone need to login to PrettyGirl2u to see their pretty girls from now on.

How to prevent other sites from displaying your images with .htaccess hotlink protection?
Create a .htaccess file and put these below in there. Change to match your domain name. Copy .htaccess to your domain root level.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)? [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

Or the easy way, use .htaccess for hotlink protection generator here to create .htaccess scripts for you.

Let’s see how much bandwidth I can save by turning on the hotlink protection.