Created
September 17, 2017 15:09
-
-
Save awakekat/a699d565b646f47a9297e2b2b2832632 to your computer and use it in GitHub Desktop.
stop WP hotlinking
This file contains hidden or 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
# in htaccess | |
# METHOD 1 | |
# CHANGE example.com to you domain | |
# Can add other file types | |
<IfModule mod_rewrite.c> | |
RewriteCond %{HTTP_REFERER} !^$ | |
RewriteCond %{HTTP_REFERER} !^http(s)?://([^.]+\.)?example\ | |
.com [NC] | |
RewriteRule \.(gif|jpe?g?|png)$ - [NC,F,L] | |
</IfModule> | |
# in htaccess | |
# METHOD 2 with replace img | |
# CHANGE example.com to you domain | |
# Can add other file types | |
<IfModule mod_rewrite.c> | |
RewriteCond %{HTTP_REFERER} !^$ | |
RewriteCond %{HTTP_REFERER} !^http(s)?://([^.]+\.)?example\ | |
.com [NC] | |
RewriteCond %{REQUEST_FILENAME} !hotlink.gif [NC] | |
RewriteRule \.(gif|jpe?g?|png)$ /hotlink.gif [NC,R,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment