Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

I tried to ban some guy by REMOTE_HOST . . .

but all I got was a lousy 500 Internal Server Error

7:14 am on Oct 18, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:May 15, 2003
votes: 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?

2:09 pm on Oct 22, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Aug 20, 2003
votes: 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.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members