Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Using Apache to Ban IP / Domains

which is better way - httpd.conf or .htaccess

3:10 pm on Jun 27, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 3, 2003
votes: 0

I have around 70 domains on a server and I would like to ban certain ip addresses from download / browsing all these websites.

Initially, I used to do this with .htaccess, but adding new rules (ips) everytime to all 70 websites via .htaccess is pretty time consuming.

I am the system admin and have access to httpd.conf. Would it be wise to use these rules in httpd.conf?

Using something like below in httpd.conf:

<Directory "/">
order allow,deny
allow from all

deny from
deny from

Would this cause extra load on the server than what was actually using .htaccess for each domains?

Thanks and please provide me with your inputs.

[added: In case I have placed the above code in both httpd.conf and .htaccess, will the server read through both of them which might cause an extra load. So in case I use httpd.conf, should I remove the .htaccess files?]

[edited by: Imaster at 3:35 pm (utc) on June 27, 2007]

4:58 pm on June 27, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 11, 2004
votes: 0

httpd.conf is read once upon Apache starting. .htaccess is read for EVERY request coming in to the server!

If you can, use httpd.conf


6:00 pm on June 27, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:Feb 10, 2006
votes: 0

you could use IPtables (in conjunction with .htaccess perhaps) - see if this thread gives you any ideas: