通过 .htaccess 禁用服务器令牌破坏网站

Cla*_*nus 2 apache .htaccess server

我已将以下代码添加到我网站根文件夹中的 .htaccess 文件中:

# Disable server signature
ServerTokens ProductOnly
ServerSignature Off
# END SCCC    
Run Code Online (Sandbox Code Playgroud)

它导致我的网站崩溃:

Internal Server Error:
The server encountered an internal error or misconfiguration and was 
unable to complete your request.
Run Code Online (Sandbox Code Playgroud)

删除该servertokens行,它按预期工作并删除签名。

我应该如何禁用服务器令牌?如果我禁用签名,我什至需要吗?

Cro*_*ses 5

ServerTokens只能在服务器配置(httpd.conf)中使用:http :
//httpd.apache.org/docs/current/en/mod/core.html#servertokens

这是在确定.htaccessServerSignature