Monday, July 28, 2014

Url rewrite -Restrict Hot Linking Image of Website to be used by other website.

Hot-linking:
URL Rewrite can be also used to prevent/filter other sites from using your website images from their site . Hot-linking can increase traffic to your site , it also a kind of copyright issues.
 
Resolution: We can observe http_referer — the referring website. If it's not your own site, you can assume that it's a hot-link attempt. You must ensure that the domain name matches exactly, so it's wise to precede the hot-linking rule with the Canonical Domain Name rule.

The following example will replace the attempted image with your own image, called prohibited.png. This is  not fullproof solution as it rely on Http_referer as one can never use HTTP_Referer to get away with this.

Add a note here

   

      
Create URL Rewrite Rule
1. Click the URL Rewrite module.
2. Add Rules
3. Blank Rule
4. Name = Prevent image Hotlinking (Or whatever friendly name you would like)
5. Pattern = .*\.(gif|jpg|png)$
6. Add Condition
a. Condition Input = {HTTP_REFERER}
b. Input String = Does not Match the Pattern
c. Pattern = ^$
7. Add a second Condition
a. Condition Input = {HTTP_REFERER}
b. Input String = Does not Match the Pattern
c. Pattern = http://www.MyAuthenticWebsite.com/ .*   (Replace www.MyAuthenticWebsite.com with your domain)
8. Action Type = Rewrite
9. Rewrite URL = /images/prohibited.png    (Replace prohibited.png with whatever image you would like to show)
10. Click Apply
10. Click Back to Rules
      

         

          ^

http://MyWebsite.*" negate="true" />
      

       prohibited.png" />

   
 
By using this, as best practice,
  • we have shielded a security concerns,
  • try to safe guard copyright issue
  • To certain extent performance engineering by reducing unnecessary traffic from unknown sources.
Post a Comment