homepage Welcome to WebmasterWorld Guest from 54.198.224.121
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
libwww-perl and Python.urllib
.htaccess problem
keyplyr




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

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.

 

netcommr




msg:1518662
 6:08 am on Aug 11, 2003 (gmt 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]

keyplyr




msg:1518663
 5:48 pm on Aug 11, 2003 (gmt 0)

Thanks, but that also causes internal server error.

jdMorgan




msg:1518664
 1:09 am on Aug 12, 2003 (gmt 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

keyplyr




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved