May 27, 2022, 06:12:17 PM

News : Linux Help Community Forum..


Hotlink Protection using htaccess creates a problem

hotlink protection
0 (0%)
htaccess rule
0 (0%)

Total Members Voted: 0

Author Topic: Hotlink Protection using htaccess creates a problem ., plz help  (Read 2230 times)

Offline dsksivakumar

  • New Member
  • Posts: 3
i have applied htaccess rule to stop hotlinking of image from my site. The rule i applied to stop bandwidth steeling from my site is

RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$

RewriteCond %{HTTP_REFERER} !^http://(.+\.)?www.mysite\.com/ [NC]

RewriteRule \.(gif|jpe?g|png)$ – [F]

This rule deny the image from hotlinking from my site.

But for testing i copied the "img src" link or code of the image from my site's source and copied to the index.html page of another site.  When i opened the another site , the image i made to hotlink from my site to another site was blocked and got forbidden error when accessing the imagepath.

This seems that the hotlinking protection rule using htaccess works.
But the problem is the image which i made to be hotlink to the another site is missing or gets disappear in my site.
When i disable the hotlink protection rule , that image is visible in my site.

I need help to solve this problem . such that image which is hotinked should not be displayed in another site and also it should not disappear from my site when applying the hotlink protection rule... Plz do help ASAP..............................................