PDA

View Full Version : how do u ip ban individuals using .htaccess


NerD
24-11-2000, 16:24
this is driving me nuts :(

I'm running a forum on an Apache Server and i want to be able to ban known undesirables ( spammers, e.t.c. ) using .htaccess

i tried

order mutual-failure
deny from .spammers.com
allow from all

it's meant to ban everyone with ips ending in .spammers.com but it just let everyone in coz it seems the allow line is overriding the deny line. I dont understand this because mutual-failure is meant to mean only ppl who appear in the allow list but do NOT appear in the deny list are allowed in and also there is meant to be no short-circuiting the evaluation process.

this works but is inconvenient

order mutual-failure
deny from .spammers.com
allow from .jp .net .co.uk

because i would have to enter almost infinite domain endings like .jp .ru so that foreign vistors arent denied

I'm sure there is something small i'm overlooking.

NerD
24-11-2000, 17:16
lol got it now, my .htaccess file now reads :

order allow,deny
allow from all
deny from 213.123.44.211 62. .btinternet.com

i had thought of that earlier but it didnt seem to work must have mistyped something :)

deny now overrides allow so you can ban individuals (static ips anyway hehe ), domains, sub domains, subnets e.t.c.

I tested it using my btinternet dialup and was wondering why sometimes i was getting in and other times I wasn't
A simple whois revealed all. The ips starting with 213. map to the domain .bt.net and the ones starting with 62. map to .btinternet.com

This rocks , its server side so is more secure than a javascript solution.

Might not stop a determined hacker but it will keep out causual undesireables :E