在 .htpasswd 上添加评论
Add a comment on .htpasswd
我想知道是否可以在 .htpasswd
文件上写评论。
为什么?因为有时候,我们不得不 "disable" 一些用户,只是几天。我查看了 Whosebug 和其他网站,看起来很混乱:
- 不可能
- 可能
::
- 可能
#
(如 .htaccess)
::bar:$apr1$G3iw8iqc$IGNoXDw7e7HolcSgE/V0a0
#foo:$apr1dJLDmbn$/zODUbSXmqDfeeCmMFKO8/
注意:例如,我不想通过在行首添加假字符来禁用用户。如果可能的话,我想要一个干净的方法;)
经过测试,两者似乎都有效,但我需要一些专家意见(顺便说一下,VIm 语法高亮既不 ::
也不 #
)
据我所知,这些文件的语法与其他 Apache 配置文件相同。 Apache 没有专门为 .htpasswd
记录这一点,但是 says generically 可以使用 #
将注释添加到它们的配置文件中。评论只能跨越一行。指令必须在一行上,但在行尾附加 \
时可以跨越多行。
Apache 的配置文件格式(其中 .htaccess
文件是一个示例)在技术上不支持内联注释,仅支持全行注释(即一行 beginning #
).
Lines that begin with the hash character "#" are considered comments, and are ignored. Comments may not be included on a line after a configuration directive. -- Official Apache 2.4 manual
我想知道是否可以在 .htpasswd
文件上写评论。
为什么?因为有时候,我们不得不 "disable" 一些用户,只是几天。我查看了 Whosebug 和其他网站,看起来很混乱:
- 不可能
- 可能
::
- 可能
#
(如 .htaccess)
::bar:$apr1$G3iw8iqc$IGNoXDw7e7HolcSgE/V0a0
#foo:$apr1dJLDmbn$/zODUbSXmqDfeeCmMFKO8/
注意:例如,我不想通过在行首添加假字符来禁用用户。如果可能的话,我想要一个干净的方法;)
经过测试,两者似乎都有效,但我需要一些专家意见(顺便说一下,VIm 语法高亮既不 ::
也不 #
)
据我所知,这些文件的语法与其他 Apache 配置文件相同。 Apache 没有专门为 .htpasswd
记录这一点,但是 says generically 可以使用 #
将注释添加到它们的配置文件中。评论只能跨越一行。指令必须在一行上,但在行尾附加 \
时可以跨越多行。
Apache 的配置文件格式(其中 .htaccess
文件是一个示例)在技术上不支持内联注释,仅支持全行注释(即一行 beginning #
).
Lines that begin with the hash character "#" are considered comments, and are ignored. Comments may not be included on a line after a configuration directive. -- Official Apache 2.4 manual