Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have this set in my .htacess file:

Order Allow,Deny
Deny from all
Allow from localhost
Allow from 86.101.198.88 (my ip)

ErrorDocument 404 /block/?code=404
ErrorDocument 403 /block/?code=403

But for some reason, I don't have permission to access from localhost and using my IP either. I just keep getting redirected to the ErrorDocument for error 403. What am I missing?

share|improve this question
    
@MichaelHampton Apache/2.2.22 (WIN32) & PHP/5.3.24 –  DJDavid98 Apr 24 '13 at 21:27
    
@Zoredache Nah, tried to put it everywhere, no luck. –  DJDavid98 Apr 24 '13 at 21:33

1 Answer 1

up vote 2 down vote accepted

From https://httpd.apache.org/docs/2.0/mod/mod_access.html

Allow,Deny First,

all Allow directives are evaluated; at least one must match, or the request is rejected. Next, all Deny directives are evaluated. If any matches, the request is rejected. Last, any requests which do not match an Allow or a Deny directive are denied by default.

Since you have a Deny from all, and your order is Allow,Deny, everything will be blocked. You probably want order Deny,Allow instead.

Deny,Allow

First, all Deny directives are evaluated; if any match, the request is denied unless it also matches an Allow directive.

share|improve this answer
    
Oh wow, it's that simple? Thanks! –  DJDavid98 Apr 24 '13 at 21:39
    
+1. I've always hated these directives for not making any damn sense except perhaps to people with a Ph.D. in mathematics. Fortunately it's been replaced in 2.4 with a system that actually makes sense to the rest of us. –  Michael Hampton Apr 24 '13 at 21:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.