Skip to content

Instantly share code, notes, and snippets.

@luizbills
Last active October 27, 2025 21:39
Show Gist options
  • Select an option

  • Save luizbills/6f81789b5be0987811fe11d170f3fc2f to your computer and use it in GitHub Desktop.

Select an option

Save luizbills/6f81789b5be0987811fe11d170f3fc2f to your computer and use it in GitHub Desktop.
Hotlink protection for Apache or OpenLiteSpeed
# BEGIN HOTLINK PROTECTION
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?bing.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yahoo.com [NC]
RewriteRule \.(jpg|jpeg|png|gif|svg)$ - [NC,F,L]
# END HOTLINK PROTECTION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment