.htaccess:无效命令 'Allow',可能拼写错误或由未包含在服务器配置中的模块定义

.htaccess: Invalid command 'Allow', perhaps misspelled or defined by a module not included in the server configuration

我在本地机器上使用的 Apache 版本是 2.4,当我在浏览器中访问我的应用程序 url 时,出现此错误。

/var/www/app/public/.htaccess: Invalid command 'Allow', perhaps misspelled or defined by a module not included in the server configuration

这是我的 .htaccess 文件的内容:

SetEnvIf Request_URI ^/SOME_ENPOINT/ noauth=1
SetEnvIf Request_URI ^/auth/ noauth=1

AuthUserFile /var/www/app/.htpasswd
AuthType Basic
AuthName "APP Login"

Require valid-user
Allow from env=noauth

我想我会在 .htaccess 文件中删除下面的这行代码。

Allow from env=noauth

我已经启用了我的 apache 服务器的 mod_env 模块。

有没有办法解决这个问题但使用环境变量noauth?谢谢:)

这些是遗留的访问控制指令。端口 Orderallowdeny 到 "Require" 或加载 mod_access_compat 模块在您的(非 htaccess)apache 配置中。