Forum Moderators: phranque
However, when I installed the code (all pipes were replaced and space added before "!"):
RewriteCond %{HTTP_USER_AGENT} ^libwww-perl/[0-9] [NC]
RewriteCond %{REMOTE_ADDR}!^209\.73\.(1[6-8][0-9]¦19[01])\.
RewriteCond %{REMOTE_ADDR}!^209\.131\.(3[2-9]¦[45][0-9]¦6[0-3])\.
RewriteCond %{REMOTE_ADDR}!^209\.237\.23[2-5]\.
RewriteRule!^forbidden\.html$ - [F]
RewriteCond %{HTTP_USER_AGENT} ^(Python.urllib¦Java/?[1-9]\.[0-9]) [NC]
RewriteCond %{REMOTE_ADDR}!^216\.239\.(3[2-9]¦[45][0-9]¦6[0-3])\.
RewriteRule!^forbidden\.html$ - [F]
My site shuts down with internal server error. This is the error:
Sun Aug 10 22:26:44 2003] [alert] [client my_IP_#] /www/m/my_domain/htdocs/.htaccess: RewriteCond: bad argument line '%{REMOTE_ADDR}!^209\.73\.(1[6-8][0-9]¦19[01])\.'
Although I can see the line that the error referrs to, I don't understand how to correct it.
Thanks.
RewriteCond %{HTTP_USER_AGENT} ^libwww-perl/[0-9] [NC]
RewriteCond %{REMOTE_ADDR}!^209\.73\.(1[6-8][0-9]¦19[01])\.*$
RewriteCond %{REMOTE_ADDR}!^209\.131\.(3[2-9]¦[45][0-9]¦6[0-3])\.*$
RewriteCond %{REMOTE_ADDR}!^209\.237\.23[2-5]\.*$
RewriteRule!^forbidden\.html$ - [F]
RewriteCond %{HTTP_USER_AGENT} ^(Python.urllib¦Java/?[1-9]\.[0-9]) [NC]
RewriteCond %{REMOTE_ADDR}!^216\.239\.(3[2-9]¦[45][0-9]¦6[0-3])\.*$
RewriteRule!^forbidden\.html$ - [F]
Your code looks identical to what I posted, and to what I've currently got running on three different sites.
I've checked what you posted three times, and came up with nothing but eyestrain... I suspect you've either got a stray character in there, or perhaps you missed a space or a pipe.
You could comment out the lines with IP address RewriteConds one-at-a-time and see if you can zero in on one line. Sometimes the error log is off by a line or two. Don't comment-out the USER_AGENT lines, though - you'll block everyone except the remaining IPs!
Jim