“.htaccess”文件可以与 npm 的 "http-server" 命令一起使用吗?

Can ".htaccess" file work with npm's "http-server" command?

这可能是一个菜鸟问题,但尽管 npm http-server 页面指出:

...http-server is a simple, zero-configuration command-line http server...

这是否意味着它完全无视 .htaccess 文件?如果是这样,是否有另一个(但仍然易于使用)读取和使用它的 HTTP 服务器替代方案?

.htaccess 是一个 Apache 配置文件。由于 Apache 不是 npm,因此 Apache 配置文件显然不适用于 npm。

Npm 使用环境变量和 npmrc 文件来配置。参见 this documentation page

在你的情况下,this 可能会做你想做的事情。