Skip to content

Instantly share code, notes, and snippets.

@samazgor
Forked from NinjaPress/.htaccess
Created July 30, 2021 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samazgor/fd6aa4267945222f45534904994c6537 to your computer and use it in GitHub Desktop.
Save samazgor/fd6aa4267945222f45534904994c6537 to your computer and use it in GitHub Desktop.
Evitando HotLinking via .htaccess no Wordpress (Exceto permitidos)
# Disable hotlinking of images with forbidden message
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?seu-dominio.com.br/.*$ [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
RewriteCond %{HTTP_REFERER} !googleusercontent\. [NC]
RewriteCond %{HTTP_REFERER} !bing\. [NC]
RewriteCond %{HTTP_REFERER} !feedburner\. [NC]
RewriteCond %{HTTP_REFERER} !twitpic\. [NC]
RewriteCond %{HTTP_REFERER} !pinterest\. [NC]
RewriteCond %{HTTP_REFERER} !tumblr\. [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(.+\.)?(.+\.)?tfbnw\.(com|net) [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(.+\.)?(.+\.)?facebook\.(com|net) [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(.+\.)?(.+\.)?feedburner.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(.+\.)?fbcdn\.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(.+\.)?facebook\.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(.+\.)?msn\.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(.+\.)?live\.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?googleusercontent.com [NC]
RewriteCond %{HTTP_REFERER} !(.*)googleusercontent.com/gadgets/proxy(.*) [NC]
RewriteCond %{HTTP_USER_AGENT} !^facebookexternalhit.*$ [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*Android.*$ [NC]
RewriteCond %{REQUEST_URI} !^/images/
RewriteRule \.(gif|jpg|jpeg|png|mp3|flv|swf|zip|rar|mpeg|mpg|wma|wmv|pdf|xls|doc|xlsx|docx|ppt|pptx|txt|rtf)$ http://ninjapress.com.br/images/sem-hotlinking.jpg [NC,R,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment