Skip to content

Instantly share code, notes, and snippets.

@cmpscabral
Forked from codepo8/redirect
Created January 22, 2014 15:18
Show Gist options
  • Save cmpscabral/8560502 to your computer and use it in GitHub Desktop.
Save cmpscabral/8560502 to your computer and use it in GitHub Desktop.
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
# allowed domains, add as needed
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?christianheilmann.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?wait-till-i.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mozilla.org [NC]
# search engines and social sites and stuff
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteCond %{HTTP_REFERER} !search\/cache [NC]
RewriteCond %{HTTP_REFERER} !cache [NC]
RewriteCond %{HTTP_REFERER} !bing\. [NC]
RewriteCond %{HTTP_REFERER} !fbcdn\. [NC]
RewriteCond %{HTTP_REFERER} !facebook\. [NC]
RewriteCond %{HTTP_REFERER} !pinterest\. [NC]
RewriteCond %{HTTP_REFERER} !feedly\. [NC]
RewriteCond %{HTTP_REFERER} !pulse\. [NC]
RewriteCond %{HTTP_REFERER} !aol\. [NC]
RewriteCond %{HTTP_REFERER} !t\. [NC]
# image to redirect to
RewriteRule \.(jpg|jpeg|png|gif)$ http://i.imgur.com/wXVywfE.jpg [NC,R,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment