homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Gold Sponsor 2015!
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

I tried to ban some guy by REMOTE_HOST . . .
but all I got was a lousy 500 Internal Server Error

10+ Year Member

Msg#: 481 posted 7:14 am on Oct 18, 2003 (gmt 0)

This is the .htaccess file in question:

# RewriteEngine on
# RewriteCond %{REMOTE_HOST} ^dsl.rcsntx.swbell.net [NC]
# Rewrite Rule .* [F]

<Files 403.shtml>
order allow,deny
allow from all

deny from 65.68.
deny from 12.241.
deny from 66.138.
deny from 66.140.
deny from
deny from
deny from
deny from 65.67.
deny from 65.65.
deny from 65.66.
deny from

Yeah, so this friend of mine is trying to keep this guy who has been harrassing her off her page, but he's a moving target. I want to ban by host and user_agent (once I find out what that is). She made up a special 403 page for him (Kirk and Spock in a compromising position, if you're curious). Anyway, she used cPanel to generate the uncommented code, and the lines commented out were me. I had to comment them out because I was getting a 500 when I tried to access the site. What did I do wrong (and how can I fix this)?

Obviously, if I get the REMOTE_HOST block to work (and I intend to add a USER_AGENT condition once it does), then I can remove those deny ip's but one might want to ban other ip's in the future (Cyveillance, other scum).

Also, I want to serve up the proper "hi, you've been 403'd" file, which I think is what that "<Files>" thing is about. (I've never gotten that to work properly on my own website.)

I have discovered a bit of a problem--I tried to echo REMOTE_HOST and got "(none)" as a response. But the server does run reverse lookup on the server logs as they are created. Is there any way I can turn that variable on?



10+ Year Member

Msg#: 481 posted 2:09 pm on Oct 22, 2003 (gmt 0)

The reason it didn't work was because RewriteRules should come in this form:

RewriteRule Pattern Substitution [flags]

So your RewriteRule should be like this:

RewriteRule .* - [F]

A better way of banning would be to ban by IP block instead. To do that with mod_rewrite, you'd use a RewriteCond for REMOTE_ADDR.

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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved