Welcome to WebmasterWorld Guest from 54.196.214.35

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

libwww-perl and Python.urllib

.htaccess problem

     
5:43 am on Aug 11, 2003 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:5817
votes: 64


I've been getting hit by www-perl/5, and found this thread (now closed) [webmasterworld.com] which offers jdMorgan's rewrite cond/rules to deal with this UA.

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.

6:08 am on Aug 11, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 22, 2000
posts:384
votes: 0


does this work?


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]
5:48 pm on Aug 11, 2003 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:5817
votes: 64


Thanks, but that also causes internal server error.

1:09 am on Aug 12, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


keyplr,

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

1:40 am on Aug 12, 2003 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:5817
votes: 64


Yeah, it WAS lacking proper spacing. It's working now, or at least the htaccess file is not bringing down the site. Thanks for the tip on commenting out lines to narrow it down, that's what help me find the error.