htaccess order Deny,Allow rule

Posted by aspiringCodeArtisan on Server Fault See other posts from Server Fault or by aspiringCodeArtisan
Published on 2014-06-09T03:55:11Z Indexed on 2014/06/09 21:27 UTC
Read the original article Hit count: 245

Filed under:
|

I'd like to dynamically add IPs to a block list via htaccess. I was hoping someone could tell me if the following will work in my case (I'm unsure how to test via localhost).

My .htaccess file will have the following by default:

order allow,deny
allow from all

IPs will be dynamically appended:

Order Deny,Allow
Allow from all
Deny from 192.168.30.1

The way I understand this is that it is by default allow all with the optional list of deny rules. If I'm not mistaken Order Deny,Allow will look at the Deny list first, is this correct?

And does the Allow from all rule need to be at the end?

© Server Fault or respective owner

Related posts about apache-2.2

Related posts about .htaccess