Home > database >  Upgrading Apache 2.4 suddenly breaks because of my .htaccess Order directive
Upgrading Apache 2.4 suddenly breaks because of my .htaccess Order directive

Time:02-28

After upgrading my version of Apache 2.4, my web application (FlightPath) suddenly broke, displaying a 500 Internal Error.

I eventually tracked it down to this statement in my .htaccess:

Order allow,deny

Turns out, the "Order" directive is deprecated in Apache 2.4, and with this latest update on my server it apparently started just dying with the dreaded 500 Internal Error.

CodePudding user response:

I found my solution thanks to looking at other open-source software's .htaccess files.

When you don't know if your client is going to be using Apache 2.2 or 2.4, this is how you need to structure an If statement:

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

This will still use Order for Apache 2.2 sites, but use the new Require for Apache 2.4 sites.

  • Related