0

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?

0

1 Answer 1

2

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.

3
  • Oh wow, it's that simple? Thanks!
    – SeinopSys
    Apr 24, 2013 at 21:39
  • 1
    +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. Apr 24, 2013 at 21:41
  • I highly suggest you edit some of what @MichaelHampton linked into the answer, because this question has been getting quite a few hits recently and people might actually be looking for the 2.4 solution instead when they find this question.
    – SeinopSys
    Mar 7, 2016 at 20:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .