"Require not allowed here" drupal 更新后

"Require not allowed here" after drupal update

刚刚将 Drupal 升级到 7.55 并出现 500 错误。 打开 logs/error.log 并看到升级后出现的内容:

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

我看到更新已经替换了这个:

<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>

有了这个:

<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>

我已经改回来了,现在好像可以了,但是这里有什么问题?

.htaccess: Require not allowed here

您的服务器配置必须允许您在 .htaccess 中使用该指令

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

Override: AuthConfig

这意味着 AllowOverride 需要包含 AuthConfig 或设置为 All,以便您能够在 .htaccess 上下文中使用 Require 指令。

“要求”是一种 AuthConfig 指令。您需要在 httpd.conf 中指定该类型的指令在 .htaccess 中是允许的。

<Directory DIRECTORY>
    ...
    AllowOverride AuthConfig
</Directory>

这里的DIRECTORY是.htaccess所在的目录

https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride