2

My site is down and depending on what I change I get a 500 error or a 404 or a "Forbidden you are not authorized" error. In checking my .htaccess files I found a strange one:

<IfModule !mod_authz_core.c>
  Order deny,allow
  Deny from all
</IfModule>
<IfModule mod_authz_core.c>
  Require all denied
</IfModule>

Would "Deny from all" and "Require all denied" be the reason my site is down? It seems like this would be the cause, right?

  • Have you tried removing it all and seeing if your site works? – Steve Feb 16 '17 at 3:52
  • As well, I usually reserve these types of statements for the configuration files and not .htaccess. – closetnoc Feb 16 '17 at 4:52
1

I get a 500 error or a 404 or a "Forbidden you are not authorized" error.

The code you posted should result in a 403 Forbidden for all visitors. The first <IfModule> block applies to Apache 2.2 (and below) and the second block applies to Apache 2.4+ (strictly Apache 2.3+). Although the first block alone would "work" on both Apache 2.2 and 2.4 if you removed the <IfModule> wrapper.

I say "should", because, whatever error document is being served when the 403 is triggered could change the HTTP status to something else. Sometimes a 404 might be preferable to a 403 and sometimes the server is simply misconfigured.

You also shouldn't be getting different errors with the same block of code.

Would "Deny from all" and "Require all denied" be the reason my site is down?

If that is the only code in your .htaccess file then yes, that would certainly be one big reason! However, that code is quite deliberate and looks a bit dubious since it is specifically targeting multiple server versions.

...depending on what I change

What things were you changing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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