Search code examples
apache.htaccessdrupal-7

"Require not allowed here" after drupal update


Just upgraded Drupal to 7.55 and got a 500 error. Opened up logs/error.log and saw this appearing since the upgrade:

<site-root>/.htaccess: Require not allowed here

I see that the update has replaced this:

<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
        Order allow,deny
    </FilesMatch>

With this:

<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order allow,deny
  </IfModule>
</FilesMatch>

I've changed it back and now it seems OK, but what is the problem here?


Solution

  • .htaccess: Require not allowed here

    Your server configuration must allow that you use that directive in .htaccess

    http://httpd.apache.org/docs/2.2/mod/core.html#require says,

    Override: AuthConfig

    and that means AllowOverride needs to include AuthConfig or be set to All, for you to be able to use the Require directive in .htaccess context.