Skip to content

Instantly share code, notes, and snippets.

@minichiello
Created December 12, 2009 15:23
Show Gist options
  • Save minichiello/254929 to your computer and use it in GitHub Desktop.
Save minichiello/254929 to your computer and use it in GitHub Desktop.
Hotlink Protection with .htaccess
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png)$ - [F]
-OR-
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment