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 OnRewriteBase /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.4Didn't work either.What am I doing wrong and why can't I ban any ip, let alone the amazonaws ones?
Banning IPs through my htaccess doesn't work. Why?
htaccess
Check your /etc/apache2/apache2.conf or /etc/apache2/httpd.conf, or if you have multi-hosting, /etc/apache2/sites-available/mydomain.com.conf for the presence of AllowOverride All.Next try it this way:RewriteEngine OnRewriteCond %{HTTP_REFERER} ^.*amazonaws\.com$ [NC,OR] RewriteCond %{REMOTE_HOST} ^.*compute-1\.amazonaws\.com$ [NC,OR] RewriteCond %{REMOTE_ADDR} ^12.148.196.(12[8-9]|1[3-9][0-9]|2[0-4][0-9]|25[0-5])$ [OR]RewriteRule .* - [F,L]These are examples created from my own .htaccess file. The IP address range in the example is an amazonaws.com IP address range, but may not be the IP address range that you need. You notice I removed the RewriteBase. It is not necessary unless you need it for another reason.You may also want to break these up into separate Cond/Rule sets to make things easier. If there is even one error using [OR], then the whole set fails. If you separate into three separate sets, the only the one that fails - fails.