为什么 .htaccess auth 命令在 Drupal 9 的目录中不起作用

why is the .htaccess auth command not working in a directory in Drupal 9

我在我的网站默认文件目录下有一个迷你网站,我正在尝试使用我放在同一目录中的以下 .htaccess 文件对其进行密码保护:

#Protect Directory
AuthName "Dialog prompt"
AuthType Basic
AuthUserFile /Users/dianacastillo/Projects/dam/web/sites/default/files/microsites/food-lineup/.htpasswd
Require valid-user

我还在同一目录中创建了一个 .htpasswd 文件。

然而,当我从站点浏览到此目录时,它不要求任何身份验证。有什么问题吗?

这没有用,因为我使用的是 ddev 。 ddev 使用 nginx,而不是 apache,我在 conf.yaml 中为 ddev 切换到 apache,现在它可以工作了。