Block IP using htaccess-how


#1

Can someone post a simple “how to” block an IP address using htaccess?

And I mean a SIMPLE how to!


#2

Easy:deny from xxx.xxx.xxx.xxxThat’s all there is to it.

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#3

Really? You don’t need an “access order allow, deny” type line?

-Scott


#4

No, you don’t. It really is as simple as just “deny from IP”.

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#5

The OP was looking for a simple answer, and a basic “deny from” will work in most cases. I’ve got a very complex .htaccess file on my blog site, and I’m able to successfully block IPs with that rule.

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#6

There is a site called http://corz.org/ which contains some very useful,original and accurate htaccess tips and tricks at http://corz.org/serv/tricks/htaccess.php which if you scroll down it you will see that, as Simon rightly says, you can get away with the simplest of lines such as:-

If you have no friends

deny from all or if you have a whole friend

allow from xxx.xxx.xxx.xxx So you see, the line from scjessey in his post, ideally suits your needs.

deny from xxx.xxx.xxx.xxx
You can add other entries into an .htaccess file, as per the excellent examples at http://corz.org/ , as you need them.


Norm

Opinions are my own views, not DreamHosts’.
I am NOT a DreamHost employee OK! :@

Act on my advice at your own risk!


#7

But I don’t want to promote that :frowning:

Simply just want to leave the world a piece of peace.

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here