Last active
August 29, 2015 14:19
-
-
Save jeremybuff/0cedc21d4697345c4d83 to your computer and use it in GitHub Desktop.
Htaccess Hotlink Protection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hotlink Protection -------------------------------------------------------------------------------- | |
RewriteEngine On | |
RewriteCond %{HTTP_REFERER} !^$ | |
RewriteCond %{REQUEST_FILENAME} -f | |
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g?|png|svg)$ [NC] | |
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?yourdomain\. [NC] | |
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC] | |
RewriteCond %{HTTP_REFERER} !google\. [NC] | |
RewriteCond %{HTTP_REFERER} !yahoo\. [NC] | |
RewriteCond %{REQUEST_URI} !^/hotlinking.png$ | |
RewriteRule \.(gif|jpe?g?|png|svg)$ /hotlinking.png [NC,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment