Web Hosting Talk







View Full Version : IP banning using .htacess


easypooltutor
03-20-2001, 09:29 PM
Hello, I wanted to ask the tech gurus how to set up .htacess to ban an IP address. I was sent this piece of code but I could not make it work:

Order allow,deny
Allow from all
Deny <ip address here>

Can I use wildcard on IPs that I ban like 63.30.* ?

Please advice. Thank you!

jtan15
03-20-2001, 09:49 PM
(Limit GET POST>
order allow,deny
allow from all
deny from 62.30
(/Limit>

Make sure to change the ('s to <'s. Using this syntax will block 62.30.ANYTHING. You do not need to include the ".*" on the end.

If this still does not work, you might not be allowed to use htaccess files. You can test this by doing something like

"DirectoryIndex test.html"

Load the directory ... if test.html isn't opened (or if a 404 doesn't display), you aren't allowed to use htaccess files. In this case, are you on shared hosting or dedicated?

easypooltutor
03-21-2001, 03:15 AM
Thanks a lot. I appreciate your help.

everyone
03-24-2001, 07:30 PM
What about if there was only one IP I wanted to block or a block something like 206.180.142.140-410?

allan
03-25-2001, 10:11 AM
To block a single IP it would be:


<Limit GET POST>
order allow,deny
allow from all
deny from 206.180.142.140
</Limit>


to block a range of IPs like you are requesting, you would have to enter each on manually (snce you don't want to block the whole class C:


<Limit GET POST>
order allow,deny
allow from all
deny from 206.180.142.140
deny from 206.180.142.141
deny from 206.180.142.142
deny from 206.180.142.143
deny from 206.180.142.144
deny from 206.180.142.145
deny from 206.180.142.146
</Limit>


And so on.

easypooltutor
03-25-2001, 04:01 PM
Originally posted by uuallan
To block a single IP it would be:


<Limit GET POST>
order allow,deny
allow from all
deny from 206.180.142.140
</Limit>


to block a range of IPs like you are requesting, you would have to enter each on manually (snce you don't want to block the whole class C:


<Limit GET POST>
order allow,deny
allow from all
deny from 206.180.142.140
deny from 206.180.142.141
deny from 206.180.142.142
deny from 206.180.142.143
deny from 206.180.142.144
deny from 206.180.142.145
deny from 206.180.142.146
</Limit>


And so on.

Yeah, it's too bad (in my case) that I have to block an entire class 63.30.193 just to block one specific guy. His IP seems to be within this block though 'cause his at 63.30.193.7 one day and 63.30.193.237 the next. I'm just glad that I am only blocking 999 IPs. Oh well...

allan
03-25-2001, 04:36 PM
Originally posted by easypooltutor
[QUOTE
Yeah, it's too bad (in my case) that I have to block an entire class 63.30.193 just to block one specific guy. His IP seems to be within this block though 'cause his at 63.30.193.7 one day and 63.30.193.237 the next. I'm just glad that I am only blocking 999 IPs. Oh well...

Umm...you mean 255 :)-- well, technically, 254 usable.

easypooltutor
03-26-2001, 01:35 AM
254 is even better :)

JoeB
03-27-2001, 12:50 PM
What if i want to deny all except for a single IP.

I've got some pages that are online that only should be accessed by me from my office (static IP dsl) and I want to deny all ips except for mine.

allan
03-27-2001, 01:00 PM
Originally posted by JoeB
What if i want to deny all except for a single IP.

I've got some pages that are online that only should be accessed by me from my office (static IP dsl) and I want to deny all ips except for mine.

Joe,

Try this:

<Limit GET POST>
order allow,deny
allow from you.rip.add.ress
deny from all
</Limit>

JoeB
03-27-2001, 03:42 PM
Thanks that worked ... I see how it works now.