The story is incredibly long. Long story short, someone is using amazonaws IPs for a bot that's clicking on my Adsense ads. I'm trying to ban all amazonaws IPs, but it doesn't work. The bigger problem is that I can't ban any ip.
I tried this:
RewriteEngine On RewriteBase / RewriteCond %{HTTP_REFERER} ^http://.*amazonaws\.com [OR] RewriteCond %{REMOTE_HOST} ^.*\.compute-1\.amazonaws\.com$ [NC,OR] RewriteCond %{REMOTE_ADDR} ^xx.xx.xxx.xxx [OR] RewriteRule ^(.*)$ - [F]
xx.xx.xxx.xxx is an IP that I have access to and with which I can test if the htaccess works. Otherwise, I tried banning myself to see if it works. Doesn't.
I also tried the classic code:
# BAN USER BY IP order allow,deny allow from all deny from 1.2.3.4
Didn't work either.
What am I doing wrong and why can't I ban any ip, let alone the amazonaws ones?
OR
flag on the lastRewriteCond
directive is an error and will block everyone (theRewriteRule
will effectively execute unconditionally)! So, if neither of these rules do anything then it suggests.htaccess
overrides are disabled in your server config. Check for theAllowOverride
directive in the virtualhost / server config.