Skip to content

Instantly share code, notes, and snippets.

@adeel-raza
Created July 26, 2019 15:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adeel-raza/4052f3176112c45fe081c3c9d7a8f3b4 to your computer and use it in GitHub Desktop.
Save adeel-raza/4052f3176112c45fe081c3c9d7a8f3b4 to your computer and use it in GitHub Desktop.
Prevent image hotlinking in WordPress using .htaccess
#Prevent image hotlinking in WordPress
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourwebsite.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?facebook.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?twitter.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?other-websites-go-here.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [F]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment