Created
September 8, 2015 10:18
-
-
Save DanBeckett/5c2c1fe5688f910ac37d to your computer and use it in GitHub Desktop.
Blocking Referral Spam within your .htaccess
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
# Make sure our server has the rewrite module active. | |
# (This is very standard - it almost certainly will) | |
<IfModule mod_rewrite.c> | |
# Let the system know we’re configuring redirections here | |
RewriteEngine on | |
# Now let’s list our redirections (technically these are known as “Rewrite Conditions”.) | |
RewriteCond %{HTTP_REFERER} ^http://.*referrerurlone\.com/ [NC,OR] | |
RewriteCond %{HTTP_REFERER} ^http://.*referrerurltwo.\.ru/ [NC,OR] | |
# We can include as many copies of this line as we need to cover each url. | |
# The NC flag tells this to be case-insensitive and the OR tells the browser | |
# to move on to the next rule if this condition isn’t met. | |
# Bring it all together here - this line tells the browser to forbid access then | |
# down tools if one of the conditions we listed above is matched. | |
RewriteRule ^(.*)$ – [F,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment