Skip to content

Instantly share code, notes, and snippets.

@bagerathan
Created November 29, 2021 03:13
Show Gist options
  • Save bagerathan/d0fbe58c3edc046fba128d01d7e9262c to your computer and use it in GitHub Desktop.
Save bagerathan/d0fbe58c3edc046fba128d01d7e9262c to your computer and use it in GitHub Desktop.
[Protect WP media files] #htaccess
# Protect WP Media Files
# https://m0n.co/protect-media-files
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} /wp-content/uploads/ [NC]
RewriteCond %{HTTP_REFERER} !^https://example.com [NC]
RewriteRule .* - [F,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment