Snap Builder Public Codes Library
Snap | Generators | Login | Browse | Search | Enter Code | Export Snap Builder Public Codes Library

 

Category: >> .HTACCESS Codes Library >> Prevent hotlinking of images


Code Snippet </> Info


Snippet Name: Prevent hotlinking of images

Description: Images linked from anywhere other than your website are blocked or redirected to a custom graphic image. If using a custom graphic image be sure that the image being shown is not hotlink protected or your server can go into an endless loop.

Note: This will affect people reading posts through RSS readers.

Author:

Last Modified: 2014-05-18 05:17:22

Language: .htaccess

Highlight Mode: html

Copy Codes: Use Free Notepad ++
Bookmark and Share

Snap HTML Code Editor:
Paste the source code, make changes and instantly see it in live preview.
Snap HTML Code Editor


  About Copying

Use the code below if you want to just prevent and block hotlink. RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC] RewriteRule \.(jpg|jpeg|png|gif|psd)$ - [NC,F,L] Use the code below if you want to show a custom graphic that replaces any/all hot linked images. RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC] RewriteRule \.(jpg|jpeg|png|gif|psd)$ http://YourOtherDomain.com/images/hotlink-image.jpg [NC,R,L]


[ Snippet Options ]

 

© 2002 -  Snap Builder Public Codes Library